pad a number out, like 4567 to 004567 etc

A

Adam

Hi all,

I need to put leading zero's on a string that can be 1-5 digits in length -
so 1 would become 000001, 10 would become 000010 etc etc.

Does anyone know an easy way of achieving this ?

cheers,

Adam
 
G

Gary Miller

Adam,

Off the top of my head I believe that
Format([YourNumber],"000000") should do the trick.

Gary Miller
 
S

Steve Schapel

Adam,

Gary's suggestion is good. An alternative is to set the Format
property of the textbox to 000000

- Steve Schapel, Microsoft Access MVP
 
R

Ron Weiner

Both Gary and Steve have good suggestions. Here is another one.

Right("000000" & YourNumber,6)

Ron W
Steve Schapel said:
Adam,

Gary's suggestion is good. An alternative is to set the Format
property of the textbox to 000000

- Steve Schapel, Microsoft Access MVP


Adam,

Off the top of my head I believe that
Format([YourNumber],"000000") should do the trick.

Gary Miller
 
A

Adam

Thanks alot guys - got me out of trouble there.

cheers,

Adam

Ron Weiner said:
Both Gary and Steve have good suggestions. Here is another one.

Right("000000" & YourNumber,6)

Ron W
Steve Schapel said:
Adam,

Gary's suggestion is good. An alternative is to set the Format
property of the textbox to 000000

- Steve Schapel, Microsoft Access MVP


Adam,

Off the top of my head I believe that
Format([YourNumber],"000000") should do the trick.

Gary Miller
 

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