D
Dorci
Access 2003 - I have the following code that duplicates a record using the
copy/paste menu commands. The new record has an autonumber key field,
however, I cannot seem to access it with this code:
DoCmd.OpenForm stDocName, , , , acFormAdd, , False
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
MsgBox "me.IDnumber = " & Me.IDNumber
varNewID = Me.IDNumber
I get an error message saying, "The expression you entered refers to an
object that is closed or doesn't exist."
The new automatically generated IDNumber DOES appear on the form, but the
error message suggests it hasn't been saved to the table yet (I guess).
Therefore, I tried entering a save record command and a refresh screen
command, but that didn't work. Is there a way to access that new ID value
without exiting the screen?
Thanks!
copy/paste menu commands. The new record has an autonumber key field,
however, I cannot seem to access it with this code:
DoCmd.OpenForm stDocName, , , , acFormAdd, , False
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
MsgBox "me.IDnumber = " & Me.IDNumber
varNewID = Me.IDNumber
I get an error message saying, "The expression you entered refers to an
object that is closed or doesn't exist."
The new automatically generated IDNumber DOES appear on the form, but the
error message suggests it hasn't been saved to the table yet (I guess).
Therefore, I tried entering a save record command and a refresh screen
command, but that didn't work. Is there a way to access that new ID value
without exiting the screen?
Thanks!