J
Jan Il
Hi all - Access 2002 XP, W2K
I have a entry form on which I have a command button with the code below
that cancels the current entry if desired. When I cancel the entry, I get a
debugger error message that says:
Runtime error: 2046
The command or action 'Undo' is not available now.
It appears to balk at this part of the code which is highlighted in yellow:
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub cmdCancelRec_Click()
Dim Response As Variant
Response = MsgBox("Are your sure you want to cancel?", vbYesNo,
"Confirmmation Required!")
If Response = vbYes Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.GoToRecord , , acNewRec
Exit Sub
End If
Exit_cmdCancelRec_Click:
Exit Sub
Err_cmdCancelRec_Click:
MsgBox Err.Description
Resume Exit_cmdCancelRec_Click
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~
I have this code in another form and there are no errors at all, it works
just fine. So, I'm not sure what I have done incorrectly that is causing
this error in this form, as it does cancel the entry. I'd truly appreciate
it if someone would let me know where the mis-step is in this code. I am
obviously just not seeing it.
Jan
I have a entry form on which I have a command button with the code below
that cancels the current entry if desired. When I cancel the entry, I get a
debugger error message that says:
Runtime error: 2046
The command or action 'Undo' is not available now.
It appears to balk at this part of the code which is highlighted in yellow:
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub cmdCancelRec_Click()
Dim Response As Variant
Response = MsgBox("Are your sure you want to cancel?", vbYesNo,
"Confirmmation Required!")
If Response = vbYes Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.GoToRecord , , acNewRec
Exit Sub
End If
Exit_cmdCancelRec_Click:
Exit Sub
Err_cmdCancelRec_Click:
MsgBox Err.Description
Resume Exit_cmdCancelRec_Click
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~
I have this code in another form and there are no errors at all, it works
just fine. So, I'm not sure what I have done incorrectly that is causing
this error in this form, as it does cancel the entry. I'd truly appreciate
it if someone would let me know where the mis-step is in this code. I am
obviously just not seeing it.
Jan
