Value entered isn't appropriate for the input mask

  • Thread starter Thread starter mscertified
  • Start date Start date
M

mscertified

I have phone number input and am using an input mask (ands rapidly realizing
I am a masochist for doing this), I get a generic error message if I try to
save an invalid format. Can I replace this with a more user friendly message
that just says 'Invalid phone number'???
 
If you eliminate the mask, that removes a "feature" that many developers and
users find problematic.

If you add an event procedure to the control in which the phone number goes,
you can use your own message when you validate the entry. I'd probably use
the BeforeUpdate event of the control to make sure the entry wasn't saved
unless it passed my edits.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I agree with you about those Masks. Horrible to use!

It might help to have the area code and the number in 2 seperate fields and
choose a Number Data Type (that will ensure that no-one enters letters or
spaces). You can format both the fields so that they will have the correct
number of 0's at the start.

You'll need to decide on the criteria for an invalid number

You could use Len(your field) to check if they have entered enough Numbers
(it doesn't count the formatted 0's)
Use this in the After Update Event

If Len(Me.AreaCode) <> 4 Then

'or whatever it is in your country

MsgBox "Invalid Area Code"

Me.AreaCode.SetFocus
'don't allow them to move past this box until they get it right.

End if


Evi
 
Back
Top