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

Getting the primary key for a record inserted into Access

Status
Not open for further replies.

Guru2B

Programmer
May 24, 2000
77
GB
Hi,

Can anyone tell me if there is a way to get the primary key of a newly inserted record from the database? I am using ADO 2.5 to connect to the DB with VB 6.0.

I know that with DAO, I could get the primary key before calling the update method, but this doesn't seem to work with ADO.

Please help!
Thanks.
 
If u declare ADO as a variable
dim dcnDB as ADOBD.recordset
for example, then add the key word withevents, this will let u use several procedures maybe one of the is what u r looking for.

If ur using tghe dataenvironent just doble click the command and then look for the event that u want.
Check this out.It is very helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top