View Full Version : Custom input mask error messages


jevans
10-21-2001, 11:39 AM
Hello Everybody,

I'm using the 10 digit input mask for my telephone number field(!\(999") "000\-0000;;_). I would like to change the system generated error message with my own. In the same form I have a postal code input mask(>L0L\ 0L0).

I tried the following code, but I want seperate message for each field.

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

Const INPUTMASK_VIOLATION = 2279
If DataErr = INPUTMASK_VIOLATION Then
MsgBox "There was an input mask violation!"
Response = acDataErrContinue
End If
End Sub

Can anybody help me?



[This message has been edited by jevans (edited 10-21-2001).]

Jack Cowley
10-21-2001, 01:00 PM
Dim ctl As Control
Dim ctlName As String
Set ctl = Screen.ActiveControl
ctlName = ctl.Name

If DataErr = 2279 And ctlName = "TelephoneNumber" Then
MsgBox "There was an input mask violation in the telephone field!""
Response = acDataErrContinue
Exit Sub
ElseIf DataErr = 2279 And ctlName = "PostCode" Then
MsgBox "There was an input mask violation in the Post Code field!""
Response = acDataErrContinue
End If

[This message has been edited by Jack Cowley (edited 10-21-2001).]