add text to number field without losing leading zeros

  • Thread starter Thread starter Halfpint40601
  • Start date Start date
H

Halfpint40601

I have a query column pulling numeric data: ex. 00008
I need to add an "A" to the beginning or end of the data without losing the
leading zeros. Thanks
 
I have a query column pulling numeric data: ex. 00008
I need to add an "A" to the beginning or end of the data without losing the
leading zeros. Thanks

A number is just a number - 8, 00008 and 0000000008 are all just ways of
depicting the exact same number.

To *display* the number with leading zeros you need to convert it to a text
string using the Format() function:

"A" & Format([numberfield], "00000")

will convert a number 8 into a text string "00008" and then append a letter A
to it.
 
"A" & Right("00000" & [fieldname],5)

does the same thing, but your way looks cleaner.

John W. Vinson said:
I have a query column pulling numeric data: ex. 00008
I need to add an "A" to the beginning or end of the data without losing the
leading zeros. Thanks

A number is just a number - 8, 00008 and 0000000008 are all just ways of
depicting the exact same number.

To *display* the number with leading zeros you need to convert it to a text
string using the Format() function:

"A" & Format([numberfield], "00000")

will convert a number 8 into a text string "00008" and then append a letter A
to it.
 
Back
Top