Hi,
After OK is clicked to close a custom error msg dialog box, I want to perform two Undos followed by a switch focus.
When I perform this manually with my mouse it works fine, however, my code below to perform the same task using Vba doesn't work, specifically the Undos don't undo. I'm trying to use the undos to fully clear a textbox1 (or checkbox1) on a subform1 because I'm getting the dreaded "Update or CancelUpdate without AddNew or Edit" error. Any help would be really appreciated, thnx.
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const conErrCode = 3314
If DataErr = conErrCode Then
Beep
MsgBox ("Which Patient? Please enter the Patient UR.")
Response = acDataErrContinue
DoCmd.RunCommand acCmdUndo
DoCmd.RunCommand acCmdUndo
Form_Form1.UR.SetFocus
Else
Response = acDataErrDisplay
End If
End Sub
After OK is clicked to close a custom error msg dialog box, I want to perform two Undos followed by a switch focus.
When I perform this manually with my mouse it works fine, however, my code below to perform the same task using Vba doesn't work, specifically the Undos don't undo. I'm trying to use the undos to fully clear a textbox1 (or checkbox1) on a subform1 because I'm getting the dreaded "Update or CancelUpdate without AddNew or Edit" error. Any help would be really appreciated, thnx.
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const conErrCode = 3314
If DataErr = conErrCode Then
Beep
MsgBox ("Which Patient? Please enter the Patient UR.")
Response = acDataErrContinue
DoCmd.RunCommand acCmdUndo
DoCmd.RunCommand acCmdUndo
Form_Form1.UR.SetFocus
Else
Response = acDataErrDisplay
End If
End Sub