Access validation help

Have a primary key as a 10 digit number. Have the format as “0000000000” however I would like to make sure that if someone puts a key in that they didnt mistype it. So it should always be a 10 digit number. I have used Like “##########” however this fails on numbers such as 0012345678 because of the 0’s in front. Any ideas on how I can get around this? Ive also tried Or statements with “0#########” etc…

i would use Long Integer datatype (although this only goes up as high as 2147483647)

Can’t use a long integer. Need to use a double to allow for any range of numbers in that 10 digit format.

i forget how to do this, but on your form, apply some logic to check val <= 10 if not invoke zerofill

microsoft access doesn’t have an IsNumeric function?

They do, however does not make sure a number is x amount of digits long.

Rguy, any chance you can provide a little more info?

If you are not doing math here, I’d actually use a string that is validated against a format expression. Especially if the leading zeros are significant.

There wont be any equations applied to this ID so a text string would be possible I suppose. Only problem is that on the rest of the system they are used as a double and wasn’t sure if I’d run into conversion issues.

I’ll give changing the type to a text field with validation of “##########”. There wouldn’t be any loopholes in that would there?

Well, perhaps the system should treat it as a string.

Also, if there are no fractions involved, I think you want a long, not a double, if it has to remain a number.

The main system isn’t actually ours to change but we were able to convert the numbers to strings.