Validation Rules

T

Tom

How do I set up the following Validation Rules in a table:

1. Two chars - both must be digits(0-9)

2. Three characters - first character must be a letter

3. 6 characters - all must be digits(0-9)

4. Up to 8 digits(0-9)

5. Up to 25 characters

Thanks,

Tom
 
J

James Arnold

Tom said:
How do I set up the following Validation Rules in a table:

1. Two chars - both must be digits(0-9)

2. Three characters - first character must be a letter

3. 6 characters - all must be digits(0-9)

4. Up to 8 digits(0-9)

5. Up to 25 characters

Thanks,

Tom

Do you have 5 separate fields, or are they all part of the same?
You use "0" (zero) to represent a number, and "L" to represent a letter.
For example:

(1) 00
(2) LLL
(3) 000000

You can also use a < at the beginning to force characters to uppercase,
and > for lower.
 
T

Tom

James,

Thank you very much for the quick response!!

There are five separate fields.

1. Do you enter the validation rules inside quotes, e.g. "00" ?

2. How do I do 4 and 5?

Thanks,

Tom
 
J

James Arnold

Tom said:
James,

Thank you very much for the quick response!!

There are five separate fields.

1. Do you enter the validation rules inside quotes, e.g. "00" ?

No quotes are needed.
2. How do I do 4 and 5?

(4) 00000000
(5) If it is UP TO 25 (ie can be less) I would recommend setting the

field size to 25, as the input mask would require all 25 characters.
 
T

Tom

#4 is Up to 8 digits(0-9). Wouldn't 00000000 mean 8 digits are required?

<< as the input mask would require all 25 characters>>
Did you mean Validation Rule and not "input mask"?

Thanks,

Tom
 
J

James Arnold

Tom said:
#4 is Up to 8 digits(0-9). Wouldn't 00000000 mean 8 digits are required?

Sorry - yes it would require all 8 digits. I would set the field size to
8, and then enter code on the textbox on the form. For example, on the
keypress event:

If Not IsNumeric(KeyAscii) Then KeyAscii = 0
<< as the input mask would require all 25 characters>>
Did you mean Validation Rule and not "input mask"?

Sorry! Validation rule would require all 25 characters. I believe an
input mask would also require all 25 if you did L x 25, but you can give
it a go and see - it may not?
 
T

Tom

1. When I type in 00, Access reduces it to 0. How do I keep 00?

2. You suggested LLL for (2). The last two characters can be digits or
letters. How do I do that?

Tom
 

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