validation rule prob

yessir

Saved By Grace
Local time
Today, 07:16
Joined
May 29, 2003
Messages
349
I am trying to make the data entry person have to enter numbers into a field in this format

9000-9599

always 4 digits, a dash, and another 4 digits, no spaces, 9 chara total

I tried the validation rule as "####-####" and "####\-####"
and in the validation txt "please enter number as "####-####""

every time i enter info it throws the rule msgbox,

please help,

:confused:
 
Try this: >0000\-0000;0;_ as an input mask.
 
the problem is that as an input mask it does not store the information with the - as i wish it to..
 
i realize now that i am using the date (#) instead of number (0) but it still poses the problem of not accepting the format as

0000-0000
 
Select an Input Mask and then paste this into the box: >0000\-0000

When you click next it will ask you whether you want to store the data with the "-" between the numbers.
 
it inserts it in the table and the field retains the mask, but the table does NOT return the hyphen when called out of the table
 
Right Click on the control and select properties. Go to the data tab and click in the input mask field. Click on the button to the right of this field and follow the instructions in my previous post.
 
the problem is there is a name associated with it, thus i return 2 fields in a single control

name | code
 
That shouldn't make any difference. Can you post the database so that I have have a look at it?
 
yessir - not on the form; edit the Input Mask at table level.
 
db

here is the DB, the problem is in table employer_SIC_codes

and i was trying to do it at the form level, :(
 

Attachments

Enter the input mask at form level as well and the data will be shown in the correct format.
 
sstreet said:
Enter the input mask at form level as well and the data will be shown in the correct format.

If the hyphen is stored at table level then there is no need to use an input mask at form level. ;)
 
problem is that if stored at table level it still wont show at form...


mike, can you alter it and send it back?

included is the '97 version
 

Attachments

Mike? :rolleyes:

Okay, I had a look at it can be done at table level in Access 97. Maybe Microsoft have seen this as a bug and fixed it in whatever version you are using (A2000 or A2002.)

With your example it can't be done so I'm leaning toward the fixed hypothesis. ;)

Maybe you will have to set the Input Mask in both your table and form although does it really matter that the hyphen isn't stored? That's why we have functions like Format i.e. Format(youData, "0000-0000") for fixing the presentation of the data if, for instance, you are wanting these codes printable on a report.
 
but what of it being in a field with 2 columns, name|code

ie

accommodations | 9000-5999
 
yessir said:
but what of it being in a field with 2 columns, name|code

where exactly in the example you posted? :confused:
 

Users who are viewing this thread

Back
Top Bottom