This topic is locked

Default Value

1/24/2009 3:08:19 PM
ASPRunnerPro General questions
H
huffharper author

Newbie Here..
myTable.myFieldValue = 123
on new record I want to add 1 and default
myTable.myFieldValue =124
I used to do this in access using Last(). Since this is not my ID field I just sorted the query a-z by myFieldValue, took Last(), added one and used a combo box to let the user select this record to populate date field.
Help
Thanks
Huff

J
Jane 1/27/2009

Huff,
use Add page: Before process event to calculate new value.

Here is a sample:

str = "select max(FieldName) from TableName"

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection

Session("max_FieldName") = rstmp(0)

rstmp.close

set rstmp=nothing


Then use Session("max_FieldName") as default value on the "Edit as" settings dialog on the Visual Editortab.

H
huffharper author 1/27/2009

<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=37190&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />

Thanks so much...
Huff

Huff,

use Add page: Before process event to calculate new value.

Here is a sample:
Then use Session("max_FieldName") as default value on the "Edit as" settings dialog on the Visual Editortab.