MikeMcKeown
Programmer
I have a problem preventing the same error message appearing twice.
If you try to enter a null primary key and then close the form, you get error 515. Which I have successfully trapped in the below code.
If dataerr = 515 Then
If MsgBox("Are you sure you want to exit and not save the current record as there is no PK" vbOKCancel) = vbOK Then
response = acDataErrContinue
Cancel = False
Else
MsgBox ("CANCEL")
Cancel = True
End If
End If
This works fine - however when they have selected Ok not to save it they get an Access Warning. Saying that the record cannot be saved - click Yes to close it and no to return to the form.
Bascially the user has to enter the same information twice. Is there anyway to prevent this message from appearing.
I have tried:-
DoCmd.SetWarning False
Me.Undo
In the code above however the message still appears, is there a way of preventing appearing?
If you try to enter a null primary key and then close the form, you get error 515. Which I have successfully trapped in the below code.
If dataerr = 515 Then
If MsgBox("Are you sure you want to exit and not save the current record as there is no PK" vbOKCancel) = vbOK Then
response = acDataErrContinue
Cancel = False
Else
MsgBox ("CANCEL")
Cancel = True
End If
End If
This works fine - however when they have selected Ok not to save it they get an Access Warning. Saying that the record cannot be saved - click Yes to close it and no to return to the form.
Bascially the user has to enter the same information twice. Is there anyway to prevent this message from appearing.
I have tried:-
DoCmd.SetWarning False
Me.Undo
In the code above however the message still appears, is there a way of preventing appearing?