View Full Version : Making zeros show


brett429
05-01-2008, 12:59 PM
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!

Fifty2One
05-01-2008, 01:20 PM
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"

brett429
05-01-2008, 01:25 PM
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"

odin1701
05-01-2008, 02:44 PM
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?

brett429
05-01-2008, 02:57 PM
It shouldn't. You aren't enclosing the input mask in quotes are you?

No, it's just 0000000.

odin1701
05-01-2008, 03:04 PM
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.

neileg
05-02-2008, 05:28 AM
Format and inputmask are two different things.

Groundrush
05-02-2008, 05:59 AM
Probably not the best solution but maybe change the field type to text instead

brett429
05-05-2008, 08:31 AM
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:

http://i29.tinypic.com/2z4d6rq.jpg

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

http://i32.tinypic.com/2wegcw6.jpg

And then after tabbing to the next line:

http://i30.tinypic.com/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!!!

odin1701
05-05-2008, 09:50 AM
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.

brett429
05-05-2008, 09:58 AM
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!!!

neileg
05-06-2008, 01:50 AM
That's why I said:
Format and inputmask are two different things.

odin1701
05-06-2008, 06:39 AM
That's why I said:

We were just having a brain fart in here :P