I have query in vba like this:
DoCmd.RunSQL "INSERT INTO table (value) VALUES ('example')"
( with an auto incremented primary key called id
)
How can I get the auto incremented id generated by this insert?
I have query in vba like this:
DoCmd.RunSQL "INSERT INTO table (value) VALUES ('example')"
( with an auto incremented primary key called id
)
How can I get the auto incremented id generated by this insert?
I believe you're looking for:
@@Identity
It's similar to SCOPE_IDENTITY in T-SQL. Check out this article for more info:
http://www.mikesdotnetting.com/Article/54/Getting-the-identity-of-the-most-recently-added-record