Get Record Just Appended

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I append data (using DoCmd.RunSQL) to table JobsContWorks which has the
following fields:

ContValID (fk)
WorksID (pk - autonumber)
ParentID (for generating treeview)
OrderID (for generating treeview)
WorksName

This newly created record then needs adding to the Treeview. To do this, I
need to get the WorksID of the record just added. The only way I can think of
doing this is by finding the max WorksID. However, this is a multi-user
database so it is possible that two people may be adding records at the same
time. Potentially, the max WorksID will not be the record just added. Is
there any other way I can get the WorksID?

Just to clarify, my code goes:

DoCmd.RunSQL(strSQL) 'This appends the record using the generated SQL

<....... Some code using the WorksID of the record just added ...........>


Thanks,

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top