Reputation: 53
I try to get the ID when I open a form with a new record. So I use this kind of code :
DoCmd.OpenForm "myform", , , , acFormAdd
But when I am in the opened form, how to get the new ID created by Access, as the field is an AutoNumber ?
Upvotes: 0
Views: 3261
Reputation: 2302
Once you have started entering the record, the ID will be available using VBA code:
Me.ID
or
Me.<name of control bound to ID field>
Upvotes: 1