Tbl_Customer has 2 fields.
IntID - AutoNumber
Name - Text
Using VBA code in Access I can obtain the value of a newly created Autonumber. Because Access creates the Autonumber when the record is created, the code below assigns iIntID the newly created number.
Set rs = CurrentDb.OpenRecordset("Tbl_Customer")
rs.AddNew
rs.Fields("Name") = "Bob Smith"
iIntID = rs.Fields("IntID")
rs.Update
rs.Close
Because SQL creates the Autonumber After the record is saved, the code above doesn't work.
I'm not sure how to obtain the newly created number.
Any help would be appreciated.
IntID - AutoNumber
Name - Text
Using VBA code in Access I can obtain the value of a newly created Autonumber. Because Access creates the Autonumber when the record is created, the code below assigns iIntID the newly created number.
Set rs = CurrentDb.OpenRecordset("Tbl_Customer")
rs.AddNew
rs.Fields("Name") = "Bob Smith"
iIntID = rs.Fields("IntID")
rs.Update
rs.Close
Because SQL creates the Autonumber After the record is saved, the code above doesn't work.
I'm not sure how to obtain the newly created number.
Any help would be appreciated.