Leading Zeros

Z

Zach Loggins

Ok here is what I did with just formatting, no code.



however, when my InfoPath form pulls the data it still shows as 1, 2, 3...
and not the 0001, 0002, etc

This is in reference to:
Formatting numbers with leading zeros

Sometimes, I need to show a number field with leading zeros. For example,
instead of 1, I'd like to see 00001.

If you need this functionality, here's how it works. In table design view,
make sure the DATATYPE of the FIELD is set to NUMBER. Click on the FORMAT
line in the GENERAL tab. Set the format to 00000. This forces all numbers in
that field to show up in 5 digits with leading zeros.

For example:
5 is now 00005,
204 is now 00204,
1000 is now 01000.
 
K

Kalyan G Reddy MVP (GGK Tech)

Hello

Please mention that it has to be done in the Microsoft Access Table.
 
Z

Zach Loggins

I have done this is access. My question is in InfoPath the Box will only
display the 1 and not the Zeros in front. In access it shows the 0001. Make
since?
 
Z

Zach Loggins

Is there a formula that I could put in the text box properties that would
look at the number given (as text) and add any zeros in front to fill 4
digits?

1 as 0001
 
S

Shekar

Hi
Using rules you can set the leading zeros by appending them to the number

eg:if the length of entered number is 1 then append three leading zero's and
so on.

if string-length(.) = 1 then add action to set the fields value by using
this expression
concat("000", .)
in the same way change the expressions and conditions.
 

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

Similar Threads


Top