Im executing an Insert SQL statment (using DoCMD.RunSQL) into an Access database from VBA. The table that it inserts the data into has an Autonumber field.
I would like the database to return the value of the autonumber field and to store it in a variable in VBA
I have not tried to return an autonumber from a SQL INSERT statement, but when you do an ADO or DAO AddNew and assign a variable to a field, the autonumber is then available. ie
.
.
rs.AddNew
rs!MyField = "something"
.
.
iNumber = rs!myAutoNumber
.
.
rs.Update
.
.
regards
Brian