How are you adding the new record? If via DAO.Recordset variable, you can do
this to put that autonumber value into the lngANumber variable:
Dim rst As DAO.Recordset, lngANumber As Long
Set rst = CurrentDb.OpenRecordset("Name", dbOpenDynaset)
rst.AddNew
rst!Fieldname = 'value'
rst.Update
rst.Bookmark = rst.LastModified
lngANumber = rst!AutonumberFieldName
rst.Close
Set rst = Nothing
--
Ken Snell
<MS ACCESS MVP>
David said:
I'm coding a huge conversion routine in VBA. After I add a record to one
table I need to create a row in another table with the autonumber key in a
linked column. How do I get the autonumber key of a record I have just
added?