pad a number out, like 4567 to 004567 etc

  • Thread starter Thread starter Adam
  • Start date Start date
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
 
Adam,

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

Gary Miller
 
Adam,

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

- Steve Schapel, Microsoft Access MVP
 
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
 
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
 
Back
Top