Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input Mask Violation Message 2

Status
Not open for further replies.

ErnNJ

Programmer
May 2, 2002
21
US
Does anyone know a way to change the error message that you get from an input mask violation? I would like to change it to a message box that would specify the field and why it's in error, instead of the message that you get. So I don't have my end users asking me what an input mask is when they really don't need to know. Any help is greatly appreciated as always.
 
This is a bit of a bugaboo, and a flaw in Access, IYAM. Input mask violations are not considered "validation rule" violations, so you have to trap them separately.

It probably WON'T be do-able within a table datasheet, but you should be able to trap the error on a form - you may need to use an unbound text control, check the mask, and see if it's good, and then shove the text control value into the real field.

Is this enough to start you off, or do you need more?

Jim How many of you believe in telekinesis? Raise my hand...
Another free Access forum:
More Access stuff at
 
Thanks Hare,

It is for a form and thats how I have it set up. I figured I might not have to go that route. I was hoping there was some property (like validation text ) I could set to make it easier. Thanx for the help.
 
This might help; however, I noticed it doesn't work in 2002.

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

' Traps date error
If DataErr = 2279 Then

' Does not display message box
Response = 0
MsgBox "Please enter complete date", vbExclamation

End If

End Sub
Linda Adams
Visit my web site for writing and Microsoft Word tips: Official web site for actor David Hedison:
 
Awesome! Thats exactly what I needed. Many thanks Linda.
 
Excellent, Linda - that was the area I was leaning to, I just couldn't remember the exact error number raised with a date validation - plus ERnj didn't specifically say it was a date field.

This thread on date validation came up a few weeks ago too. I imagine you could trap the other types of input mask violation Data.Err numbers and handle them as well.

I'm curious about the not-working-in-A2K2 though. Perhaps it's a different err number?

Jim
How many of you believe in telekinesis? Raise my hand...
Another free Access forum:
More Access stuff at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top