Form Error Message Confusion

Paul Cooke

Registered User.
Local time
Today, 23:35
Joined
Oct 12, 2001
Messages
288
Hi guys

Could someone please advise what I am doing wrong here.

On my Personal Details Form I have various fields including Date Of birth, Mobile Tel Number and Home Tel Number.

I have a short date input mask for the dates of birth
I have a Telephone Mask for both the Number fields

I have the following code placed in the forms On Error event to bring up my 'custom msgbox'

Code:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
   Const INPUTMASK_VIOLATION = 2279 Or 2113
   If DataErr = INPUTMASK_VIOLATION Then
      MsgBox "All UK telephone numbers (Inc mobiles) have 11 digits" & vbCrLf & "" & vbCrLf & "Please click ok to try again and add the missing digits" & vbCrLf & "" & vbCrLf & "or delete current digits to skip the entry.", , "Incorrect Data Entered"
      Response = acDataErrContinue
  End If
   
End Sub

The problem I am getting is that this works fine for the number fields but the same message also comes up for the date of birth field.

Is there a way to have a different 'custom message come up dependant on the input mask type?

Hopefully that makes sense

Many thanks for any adivce you can offer

Paul
 
Thanks you John works a charm extacly what I needed

Paul
 

Users who are viewing this thread

Back
Top Bottom