Error handling..

wh00t

Registered User.
Local time
Today, 16:51
Joined
May 18, 2001
Messages
264
Hi

I have an on error event for a run time error which occurs

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

         Const conErrFieldRequired = 2427
        
        If DataErr = conErrFieldRequired Then
            DSPMSG "This is not a valid Customer Code, please check the number and try again."
            Response = acDataErrContinue
        Else
            Response = acDataErrDisplay
        End If
End Sub

but this is not working, the run time error still occurs, any ideas?


EDIT - the DSPMSG part, is a public function for displaying messages

[This message has been edited by wh00t (edited 05-15-2002).]
 
Possibly the error has to be associated with the control rather than the entire form? Just a guess.
 
here's what I am now using, this is in the OnExit event for the field
Code:
On Error GoTo Err_CustCode_Exit

Const conErrNotInList = 2427

Other Code Here

Err_CustCode_Exit:
    If Err.Number = conErrNotInList Then
        DSPMSG "This is not a valid Customer Code, please check the number and try again."
    Else
        DSPMSG Err.Description
    End If

this works, thanks for the suggestion
 

Users who are viewing this thread

Back
Top Bottom