I have a number feild that some users enter preceding zeros before and others do not. Is there a way I can make access ignore zeros in the beginning of a number? For example 001234 would just store 1234 and 09876 would just store 9876.
Hello Zoro!
Your best bet would be to investigate the "Input Mask" property that can be set on the field on your form. By your example you only want 4 numbers. You can set an input mask to any arrangement you choose, basically forcing the user to only input (in your case the quantity of numbers) that you establish. Go to the input mask property "field" of any field on your form and hit F1. There's tons of examples and variations. Good luck, Gord
ghubbell@total.net
I have the mask set to a max number of 8 digits but some folks are adding leading zeros to give that 8 digit max all the time. Others do not. I would prefer to ignore them if entered on exit of the feild. Sort of the why type it if you dont have to.
Hi Zorro,
I'm a little puzzled. Is this field a number field, or a text field that just always contains numbers?
If it's a number field, it should automatically chop off any leading zeros.. they don't qualify as part of a number.
Assuming it's a text field, you could do the input mask as ghubbell says (definitely easiest if it works), or if they don't all have the same number of digits, you could set the AfterUpdate event to chop off leading zeros via code.
Its a text field that always has numbers, I was adivsed to use text fields if I never planned on doing any math with the numbers. They are ID number fields. There is an 8 digit maximum but it could be anything up to that maximum. Example 01234567, 00123456, 00012345.
ghubbell raises a very good point.. I personally find if you want to use text fields, you should have the code add leading zeros if they're not provided. This will maintain sorting capability.
To add leading zeros (up to 8 characters), see thread181-65570 for sample code which you can modify for your needs..
I guess my advisor was less than helpful about using a text field huh? I suppose there is no reason I cant change this to a number field and avoid all this is there? I think I will try that on a copy of my database and see what happens. It sounds like I am making things a lot more complicated than they need to be.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.