ravi
|
Posted: 01/07/2002, 1:54 AM |
|
Hi i am in deep trouble ,
I have one key field complaint_id which is autonumber in MSACCESS
After inserting record i want to display confirmation page on which i want to display the self generated Autonumber field value "Complain_id".
I develop this page BUT I COULD NOT GETTING THE COMPLAIN_ID VALUE.
I ALSO GOES THROUGH TIPS AND ARTICLES. BUT THAT IS ALSO NOT VERY CLEAR TO ME WHERE I HAVE TO WRITE THE CODE.
THANKS IN ADVANCE
|
|
|
Allen
|
Posted: 01/07/2002, 5:35 PM |
|
You can reference http://www.gotocode.com/art.asp?art_id=80&
You can modfiy and put these code in form's "After insert" event:
----------------------------------------------------------------
pkSQL = "select max(ID_FieldName) as lastpk from table_name"
openrs rs, pkSQL
last = GetValue(rs, "lastpk")
'once you retrieve the value you can then append it to the sParams variable if the form has transfer input parameters
'sParam = sParam & &lastpk= & last
or append it to the sActionFileName variable is the form does not have transfer input parameters
sActionFileName = sActionFileName & ?lastpk= & last
|
|
|
tcd
|
Posted: 11/11/2003, 2:04 AM |
|
What about parallelism ? If another connexion to database add a new record in the same time? select max(ID_FieldName) is not a solution. But you can generate a random string and search for that string.
select max(ID_FieldName) as lastpk from table_name where rand_string=randomString. You can set randomString in before insert event code.
|
|
|
|