PDA

View Full Version : Problem with setting length with validation rule



lucpian
05-02-2008, 01:44 PM
Hi All,


I am trying to set the length of an entry in an Microsoft access in a column named Shared_Id to not be more than or less than 6. I went under the validation rule of Shared_Id, and wrote
"<6 or >6",

and have a message under the validation text, but it treats it as a range. Please, I need help with the correct format of writing it.

Thanks

Lucpian

OBP
05-03-2008, 06:02 AM
lucpian, is this a Number or a text field?
I don't think you validate the length of a number field although you can "Format" it to have leading zeroes.
If it is text you could use VBA in the After Update, or Before Update Events.

CreganTur
05-05-2008, 09:57 AM
Setting an input mask will fix this problem for you.

If Shared_ID is all numerals(digits) then use input mask: 000000
If Shared_ID is all letters then use input mask: LLLLLL
If Shared_ID can be combination of letters and numbers, then use: AAAAAA

Using an input mask is perfect for this. User entries will be rejected EVERY TIME if they do not meet the criteria for the input mask.