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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation Rule vs Input Mask

Status
Not open for further replies.

LeiDBug007

Technical User
Oct 15, 2003
33
US
Currently, no input mask in properties.

Validation Rule entered in properties is:
- Like "LLLL000000"
Validation Text entered in properties is:
- Please enter the complete file number.

When activating in data sheet view, when user enters INCORRECT information, validation text works.

But..... when user enters CORRECT information, we still get the same error message from the validation text (Please enter the complete file number.)

What's wrong??? PLEASE HELP!!!!!!!!!

Sincerely,
DRM Designers
 
Hi!

I think you are giving the users the opportunity to select only the entry "LLLL000000"

With the like operator, you can (as the help file describes) use:

Like "A????" - Entry must be 5 charachters and begin with the letter "A".

Trying an input mask would probably serve your purposes better:

LLLL0000;;_ would demand 4 letters and 4 numbers (entries required). Add a > to get only ucase letters:
>LLLL0000;;_

HTH Roy-Vidar
 
Hi Roy,
Thanx for the immediate response!

I tried your suggestion, and the format is fine.

When the CORRECT information is entered, it's fine.

However, when the INCORRECT information is entered Microsoft's error message pops (The value you entered isn't appropriate for the input mask '>LLLL000000;;_' specified for this field).

I want to them to see my own error message (Validation text?) that indicates they need to enter the correct information because what they are puting is wrong. I want my error message to pop once they enter invalid information.

Everything was fine with my initial set-up w/the Validation rule (above). But.... the error message pops when the CORRECT information is entered(?).

Hope I'm making sense. Thanx!!!

~LeiDB
 
Hi again!

I don't think there are any possibilities to avoid the inbuilt message using a table (others might perhaps shed some light on that), but form is often the preferred way of entering data, so if you're going to let users add this info thru a form, try this:

Use the forms OnError event for:

Private Sub Form_Error(DataErr as Integer, Response as Integer)
if DataErr=2279 then ' Inputmaskerror
if msgbox("The value bla bla Cancel...",vbokcancel)=vbyes then me.undo
response=acdataerrcontinue
endif
end sub

A routine in the onerror event will trigger on any error on the form.

DataErr gives the form error, 2279 is inputmaskerror
Response=acdataerrcontinue makes Access continue without displaying inbuilt errod message
Yes - focus is back on the control
Cancel - cancels the changes
Note - if dataerr<>2279 Access built in message will appear, for all other errors.

HTH Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top