Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Access 2000 Next AutoNumber Value

Status
Not open for further replies.

Michael42

Programmer
Oct 8, 2001
1,454
US
Hello, upon doing an AddNew using an Access 2000 database and an AutoNumber field how can I extract the new value that it will choose before hand?

I tried the below with mixed results:

'Get\Set Tracking Number
oRS.MoveLast
oRS("Trk_Nbr") = oRS("ID")
oRS.update

I sometimes get the error below using this code:
Microsoft Cursor Engine error '80040e38'
Row cannot be located for updating. Some values may
have been changed since it was last read.

.../process_forms.asp, line 42


Thanks for your help!
 
Use this query in another recordset

SELECT MAX(ID)
FROM YourTableName

Then put the value it returns in a variable and add one to it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top