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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LAST_INSERT_ID() with dbExpress and Access?

Status
Not open for further replies.

TimSNL

Programmer
Sep 11, 2001
119
AU
Hello,

I am using an Access database via dbExpress. In the table I have an auto number field.

Is there any way of finding out the value of the auto number field for the record I just saved using ApplyUpdates()?

With MySQL I could use LAST_INSERT_ID() function to get the auto increment value that was most recently generated during the current server session. Is there anything like this for Access?

Thankyou for your help.
Tim Dover
SNL Computing
 
Hi mate,
Maybe you could have an TQuery object querying the max value of that field (triggered by an after-post event or some event of the kind- bundled to the table object) and re-using it in your code? What do you think of that?
cheers,
BonnScott
 
bonnScott,

Thanks for the idea, but this is not secure enough for me. I must allow for concurrent data access and this delphi event would not trigger fast enough.
Thanks for the suggestion :)

Tim Dover
SNL Computing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top