I have a button on a form whose purpose is to add a new record to the underlying table.
The OnClick Event code for the button looks like
me.dirty = false
if me.NewRecord then
msgBox("new record")
else
msgBox("not new record")
end if
doCmd.goToRecord record := acNewRecord
The message box is needed to make sure that I am not already operating on a new record.
When I click the button, I get a Runtime error 2105 "You can't go to the specified record"
Does someone know why this is?
Rene
Never Mind, I found the problem
I should have used
doCmd.goToRecord record := acNewRec
instead of
doCmd.goToRecord record := acNewRecord
Yet, why access won't tell me that it doesn't know about acNewRecord....
Edit: Of course David was right: I haven't set OPTION EXPLICIT
.