Errorhandling for a phone number field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone have code to stop the Access error pop-up when entering in a
phone number wrong. I would like to have my own error message pop-up.

thanks!
 
Hi, trap the Form Error event, display your message and tell MS Access not
to display it's message:

Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2279 Then
MsgBox "Text is not formatted correctly. Please re-enter"
Cancel = acDataErrContinue
End If
End Sub

You might also be able to parse the entered data and point out the specific
error.

HTH, Graeme.
 
Back
Top