Making zeros show

brett429

Registered User.
Local time
Today, 14:29
Joined
Apr 3, 2008
Messages
114
I know this is probably a stupid question and I'm overlooking something obvious, but... I have a Long Integer field that has an input mask requirement of 7 numbers. Sometimes the number starts with a 0, but instead of showing as 0468165, it shows up as 468165. I want the 0 to show at the beginning. How can I do this? Thanks!
 
Last edited:
I know this is probably a stupid question and I'm overlooking something obvious, but... I have a Long Integer field that has an input mask requirement of 7 numbers. Sometimes the number starts with a 0, but instead of showing as 04681658, it shows up as 4681658. I want the 0 to show at the beginning. How can I do this? Thanks!

ummm your sample there is 8 numbers in the string???
anyway format the field as "00000000"
 
ummm your sample there is 8 numbers in the string???
anyway format the field as "00000000"

My mistake, it should be 7. But I already do have have an input mask of "0000000" but Access still hides the first 0s. For instance, if you type "0000001", it shows up as just "1"
 
My mistake, it should be 7. But I already do have have an input mask of "0000000" but Access still hides the first 0s. For instance, if you type "0000001", it shows up as just "1"

It shouldn't. You aren't enclosing the input mask in quotes are you?
 
No, it's just 0000000.

That should work.

I just tried it to make sure I wasn't crazy and I put in 0000025 and it stored it just like that.

Your data type is a number right?

Are you viewing the table directly, or are you viewing the data through a form/query? If on a form, the control may have a different format than your data.
 
Format and inputmask are two different things.
 
Probably not the best solution but maybe change the field type to text instead
 
It still isn't working. I took screen shots in case I'm doing something wrong, but I can't figure it out. Here's the table in design view:

2z4d6rq.jpg


In Datasheet view after I input the 0 in the front:

2wegcw6.jpg


And then after tabbing to the next line:

359j0it.jpg


I've checked the input mask for the forms I use this field in and they're set up the same way. I cannot get the 0 to stick!!!
 
The problem is that you are putting it in as the input mask. That's completely different, and I didn't even notice that's what you were doing originally. Your formatting the data as General Number, so it will remove any leading zeros.

Remove the input mask and put 0000000 in the Format field. You can leave the input mask if you like but there's not need to.

With the format put as 0000000, when you type in 0012345, it will stay that way. Also if you type in 123 it will format it to 0000123.
 
The problem is that you are putting it in as the input mask. That's completely different, and I didn't even notice that's what you were doing originally. Your formatting the data as General Number, so it will remove any leading zeros.

Remove the input mask and put 0000000 in the Format field. You can leave the input mask if you like but there's not need to.

With the format put as 0000000, when you type in 0012345, it will stay that way. Also if you type in 123 it will format it to 0000123.

There we go! I had no idea you could change the Format like that. Thank you!!!
 

Users who are viewing this thread

Back
Top Bottom