J
Justin83716
How do I get the cancel button to cancel the action in error 2169 below? I
know I need to specify what action to take when cancel is selected, but how
do I phrase it? Currently pressing OK or Cancel both respond as though you
pressed OK.
Thanks!
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 3314 Then
Response = acDataErrContinue 'Don't display the default message
MsgBox "Enter data in all required fields."
ElseIf DataErr = 2169 Then
Response = acDataErrContinue 'Don't display the default message
MsgBox "Close form without saving?", vbExclaimation + vbOKCancel
ElseIf DataErr = 2113 Then
Response = acDataErrContinue 'Don't display the default message
MsgBox "Enter valid start date."
Else
MsgBox "Error#: " & DataErr 'Display the error number
Response = acDataErrDisplay 'Display default message
End If
End Sub
know I need to specify what action to take when cancel is selected, but how
do I phrase it? Currently pressing OK or Cancel both respond as though you
pressed OK.
Thanks!
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 3314 Then
Response = acDataErrContinue 'Don't display the default message
MsgBox "Enter data in all required fields."
ElseIf DataErr = 2169 Then
Response = acDataErrContinue 'Don't display the default message
MsgBox "Close form without saving?", vbExclaimation + vbOKCancel
ElseIf DataErr = 2113 Then
Response = acDataErrContinue 'Don't display the default message
MsgBox "Enter valid start date."
Else
MsgBox "Error#: " & DataErr 'Display the error number
Response = acDataErrDisplay 'Display default message
End If
End Sub