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!

Passing @@Identity back to VBA

Status
Not open for further replies.

LeanneGodney

Technical User
Mar 7, 2002
175
GB
Hi there,

Does anyone know how to grab what the @@Identity value is once you've run an append query and use it in VBA? I'm guessing at this point I'd have to use a function to do the append and return the @@IDentity?

Thanks,
Leanne
 
On the same connection right after the insert sql, do a select on the identity.

cn.execute "your insert"
cn.execute "Select @@scope_identity"

Better to use scope identity.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top