DoCmd.RunCommand acCmdSaveRecord
DoEvents
Me.Refresh
DoEvents
MyID = Nz(Me.txtMyID.Value, 0)
ASKER
The key to @@Identity is that it returns the value of an autoincrement column that is generated on the same connection. This last bit is important, because it means that the Connection object used for the Insert query must be re-used without closing it and opening it up again.
ASKER
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.
TRUSTED BY
Dim MyID as long
DoCmd.RunCommand acCmdSaveRecord
MyID = Me.txtMyID
msgbox MyID