validation rule

F

Falcon08

What do I put down for validation rule when I want a three-digit permit
number, such as 018 and not just 18?
 
F

Falcon08

I entered the validation rule (below). When I entered 018, it did not
accept. And when I added a number, such as 0183, it accepted it as 183. For
some reason, it did not read the first number as zero, but rather as a null.
How can I make it accept zero as a number?

Chris O'C via AccessMonster.com said:
Use this:

Like "[0-9][0-9][0-9]"

In the validation text use this:

The permit number must be 3 digits.

Chris
Microsoft MVP

What do I put down for validation rule when I want a three-digit permit
number, such as 018 and not just 18?
 
J

John Spencer

Change the field type to text. IF your field type is a number field, then it
will never store leading zeroes.

Since a permit number is almost never going to be involved in a math
calculation, it probably should be stored as text. The only problem you may
run into is sorting the field in numeric order or selecting a range of permit
numbers. That can be solved in several ways.

-- Always enter leading zeroes and make sure the data in the field is all the
same length

-- If the length can vary, use the Val function or one of the conversion
functions (Like CLng) to get the numeric value of the string and use that for
range searches and numeric sorts.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
I entered the validation rule (below). When I entered 018, it did not
accept. And when I added a number, such as 0183, it accepted it as 183. For
some reason, it did not read the first number as zero, but rather as a null.
How can I make it accept zero as a number?

Chris O'C via AccessMonster.com said:
Use this:

Like "[0-9][0-9][0-9]"

In the validation text use this:

The permit number must be 3 digits.

Chris
Microsoft MVP

What do I put down for validation rule when I want a three-digit permit
number, such as 018 and not just 18?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top