Disable Microsoft Jet Engine Message Box (1 Viewer)

flemmo

Registered User.
Local time
Today, 07:32
Joined
Apr 26, 2006
Messages
69
Hi,

I have a form that contains 3 required fields i.e. linked to other tables using an ID. If the user tries to close the form without entering data in the required fields I get the message:
"The Microsoft Jet database engine cannot find a record in the table 'table name' with key matching field(s) 'myID'

I have created an If Then Else statement to check if the required fields have been filled in, and if not display a MsgBox. the problem is that Jet database engine message pops up.

I've tried using DoCmd.SetWarnings False on the form but this doesn't stop them.

Any ideas?
Cheers
 

flemmo

Registered User.
Local time
Today, 07:32
Joined
Apr 26, 2006
Messages
69
Found the solution. Place the following in the forms onError event:

Private Sub Form_Error (DataErr As Integer, Response As Integer)

Select Case DataErr
Case 3101
MsgBox "Your custom message here."
Response = acDataErrContinue
Case Else
Response = acDataErrDisplay
End Select

End Sub
 

Users who are viewing this thread

Top Bottom