Reputation: 14352
I have the following query in VBA:
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?
Upvotes: 2
Views: 7654
Reputation: 634
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
Upvotes: 7