theundergod
IS-IT--Management
Here's my dilema. I am new to VBA and am currently doing some simple VBA instead of macros in order to become more familiar. I have a button that creates a new record and have this code as the event:
DoCmd.GoToRecord , , acNewRec
For some reason the code won't work and it spits out a run-time error "2105" UNLESS I make a button, use the wizard to set it up, and then copy the code from that button to my button. The code is the same with the exception of some error handling. This is the code it produces:
On Error GoTo Err_Command22_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command22_Click:
Exit Sub
Err_Command22_Click:
MsgBox Err.Description
Resume Exit_Command22_Click
Now, if I take everything out except for the "DoCmd.GoToRecord , , acNewRec" and copy and paste it, it still works with my button. There's absolutely no difference between that code and mine. Or am I completely missing something? I have found through troubleshooting that the working code still spits out a run-time error "0". Is an error "0" a standard error that VBA uses when creating a new record?
Any information would be gladly accepted. Thanks.
-Jon
DoCmd.GoToRecord , , acNewRec
For some reason the code won't work and it spits out a run-time error "2105" UNLESS I make a button, use the wizard to set it up, and then copy the code from that button to my button. The code is the same with the exception of some error handling. This is the code it produces:
On Error GoTo Err_Command22_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command22_Click:
Exit Sub
Err_Command22_Click:
MsgBox Err.Description
Resume Exit_Command22_Click
Now, if I take everything out except for the "DoCmd.GoToRecord , , acNewRec" and copy and paste it, it still works with my button. There's absolutely no difference between that code and mine. Or am I completely missing something? I have found through troubleshooting that the working code still spits out a run-time error "0". Is an error "0" a standard error that VBA uses when creating a new record?
Any information would be gladly accepted. Thanks.
-Jon