record just created...

agehoops

Registered User.
Local time
Today, 00:16
Joined
Feb 11, 2006
Messages
351
I've got an SQL command creating a new record in a table with the ID as an auto number. Is there a way of returning the ID number of the record just created?

Thanks
 
Depending on how your db is setup you could use the DMAX or DLOOKUP functions to retrieve the value.
 
I'd thought of the DLookup but didn't know how to get it to retrieve the ID of the record that had just been created. Is the DMax function to return the last value? Never heard of that one before?
 
DMax will return the Maxium value of a field from the specified domain. If you tell me the name of your fields I can make an example for you.
 
the table is called tblAccessLog and the ID field is just called ID.
 
Dmax("ID","tblAccessLog")

You can also add criteria to the search but above will give the max value for ID in tblAccessLog
 
ah brilliant, thanks. I'll go take a look see what I can do. Thanks for your help :)
 

Users who are viewing this thread

Back
Top Bottom