Capture Input Mask Error before Access does? (1 Viewer)

darbid

Registered User.
Local time
Today, 01:21
Joined
Jun 26, 2008
Messages
1,428
My problem is that I do not like the error message Access uses when someone does not follow the input mask.

I realise that I need to caputre the error by getting the error number.

But what is the sub or event that I should put this in?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 00:21
Joined
Sep 12, 2006
Messages
15,672
might be the forms onerror routine

try seeing if an input mask error calls the forms error routine. Then you can intercept that error code, and provide your own message
 

darbid

Registered User.
Local time
Today, 01:21
Joined
Jun 26, 2008
Messages
1,428
might be the forms onerror routine
Thanks GTH you got it.
So for anyone that has got here what I have done is put the following in the forms on error event.

I want to avoid the standard Input Mask error message. The main reason is that if someone does not enter it correctly access shows the actual input mask which even I do not understand. :)

I am not sure if I have got the err number right but I get a number of 2279.

Code:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
    If DataErr = 2279 Then
        Beep
        MsgBox "Your message goes here", vbCritical, "Idiot Proofing"
        Response = acDataErrContinue 'this stops the access message
        Exit Sub
    End If
End Sub
 

Users who are viewing this thread

Top Bottom