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 Not working

Status
Not open for further replies.

altoona

Programmer
Jul 31, 2001
7
US
I have a unbound field that has:

Input mask 999999;;#
Default value 0
Validation rule >0
Validation test "invalid pen number"

Yet when I hit the enter key with 0 in this field
It just moves to the next field, without the validation rule kicking in.

Why??
 
Looks like I might have answered my own question.
The validation rule doesn't work because the default value is 0. As soon as I removed this then the rule worked.

I don't quite get this?! I didn't want the field to have to be empty. It looked better with a default value in. And 0 is the only one I could use.
 
Try defining the default value as something other than 0. The validation rule only validates values entered into the field. (huh?)
 
If I put in a 1 for the default value and make the rule >1 then the validation rule didn't work again.
Obviously if I make the default value 1 and the rule > 0
it works if I type in a 0.

It still seems like it's considering the default value something I entered.
 
A default value is never checked by the validation rule because it's not a change by the user, it's a programmatic manipulation of data. And since you set it as the default value Access never bothers to check it. By setting it to 1 you and then trying to put in a 0 it triggers properly, as you found.

Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top