Error Capture doesn't override default

Jason1971

Registered User.
Local time
Today, 13:26
Joined
Jan 19, 2009
Messages
46
Hi,

I have a Form1 containing a Subform. The Subform is based on a table and when a required field in this table is not entered the default "field is blank" error occurs. I am trying to error capture this default error and display a more helpful message. But what happens is the default message dialog box still comes up, followed by my custom message dialog box afterwards?? My code is:

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

Const conErrCode = 2169

If DataErr = conErrCode Then
MsgBox ("Which Patient? Please enter the Patient UR.")
Response = acDataErrContinue
Else
Response = acDataErrDisplay
End If

End Sub

This code is in the On Error section of Form1. If I put this code in the On Error section of the Subform then my custom error message does not appear at all.
So how do I get only my custom error message to appear?
Thanks for any help.
Jason.
Melbourne,
Australia
 
Solved it! The error code was wrong. Should have been 3314 (the error code specific to the Subform).
 

Users who are viewing this thread

Back
Top Bottom