force a leading zero in the integer

S

Souris

I would like to add a leading zero in my integer if there is single digit in
to a string.
Are there any functions to do the formating?

Your information is great appreciated,
 
R

raskew via AccessMonster.com

The format() function will do it. Example:

x = 4
? format(x, "00")
04


HTH - Bob
 
F

fredg

I would like to add a leading zero in my integer if there is single digit in
to a string.
Are there any functions to do the formating?

Your information is great appreciated,

You "can't" ADD a leading zero to an integer datatype field because
Access won't accept them. Access knows that 07 is the same integer
value as 7.
You can add leading zeros if the field is a text datatype field, i.e.
"07", or you can "Display" the Integer value with leading zero's by
setting the control's format property to:
00

7 will display as 07, 77 will display as 77, but the stored value will
still be just plain old 7.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top