Conditional Character Count/Format

  • Thread starter NeonSky via AccessMonster.com
  • Start date
N

NeonSky via AccessMonster.com

Good Day,

Please consider my sample records below......

FieldX
345
6792
56794

Desired Output......

FieldX
000000345
000006792
000056794

As you can see what I would like to do is append "X" number of "0" characters
to the begining of the strings found in field X, where the total string
length will equal nine total characters.

Any thoughts?

Thank you for your time!
 
N

NeonSky via AccessMonster.com

Sort of figured this out. I counted the length of "FieldX" by creating a
field in my query with the following function, "FieldXLength:len([FieldX]).
This created a new field that counted the number of characters in field x.
Next I just ran separate update statements that referenced the count and
appended zeros accordingly. Thanks!
 
C

Clifford Bass

Hi,

You can just use Format([FieldX], "000000000"). Much easier.

Clifford Bass

NeonSky via AccessMonster.com said:
Sort of figured this out. I counted the length of "FieldX" by creating a
field in my query with the following function, "FieldXLength:len([FieldX]).
This created a new field that counted the number of characters in field x.
Next I just ran separate update statements that referenced the count and
appended zeros accordingly. Thanks!

Good Day,

Please consider my sample records below......

FieldX
345
6792
56794

Desired Output......

FieldX
000000345
000006792
000056794

As you can see what I would like to do is append "X" number of "0" characters
to the begining of the strings found in field X, where the total string
length will equal nine total characters.

Any thoughts?

Thank you for your time!
 

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