By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,099 Members | 2,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,099 IT Pros & Developers. It's quick & easy.

SCOPE_IDENTITY in MS Access ??

JAMBAI
P: 28
Does anyone know how to get the @@Identity value after the insert query and use it in VBA.

strIns = "Insert Query"
Docmd.RunSQL, strIns

I am using linked DataFlex table through ODBC.

Thanks
Jambai
Jun 13 '07 #1
Share this Question
Share on Google+
1 Reply


ADezii
Expert 5K+
P: 8,638
Does anyone know how to get the @@Identity value after the insert query and use it in VBA.

strIns = "Insert Query"
Docmd.RunSQL, strIns

I am using linked DataFlex table through ODBC.

Thanks
Jambai
In SQL Server SELECT @@identity will retrieve the value of @@identity after an Insert Operation as in:

Expand|Select|Wrap|Line Numbers
  1. CREATE Table YourTable (col1 int not null IDENTITY (1, 100), col2 char(5) not null)
  2. Go
  3. INSERT YourTable (col2) VALUES ('some 5 character value')
  4. SELECT @@identity ==> returns 1
In my mind, the only conceivable way to reference the value returned from SELECT @@identity, and use it in VBA, is through some kind of Variable assignment. I don't even know if that is possible and I'm not at all familiar with DataFlex. Sorry I could not help you more.
Jun 13 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.