Preceding Zeros with Concatenation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 3 different fields in my table, one is a 2 digit number field, one is
a 3 digit autonumber that starts at 001, and the last is a 2 character text
field. I need to concatenate these along with some special characters
example: 04-001-AH to show up on my form. My problem is I can't get the
autonumber field to show the preceding zeros in the concatenation. I
formatted it on it's own in my table as 000 but with the concatenation it
just goes back to not showing the preceding zeros.
 
Use the Format function around the number field.

The Control Source of the text box will be something like this:
=[Field1] & Format([Field2], "\-000\-") & [Field3]
 
Thank you Duane!!!

Duane Hookom said:
Use the format() function
& Format([YourField],"000")

--
Duane Hookom
MS Access MVP


lilbomshl said:
I have 3 different fields in my table, one is a 2 digit number field, one is
a 3 digit autonumber that starts at 001, and the last is a 2 character text
field. I need to concatenate these along with some special characters
example: 04-001-AH to show up on my form. My problem is I can't get the
autonumber field to show the preceding zeros in the concatenation. I
formatted it on it's own in my table as 000 but with the concatenation it
just goes back to not showing the preceding zeros.
 
Thank you Allen!!!

Allen Browne said:
Use the Format function around the number field.

The Control Source of the text box will be something like this:
=[Field1] & Format([Field2], "\-000\-") & [Field3]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

lilbomshl said:
I have 3 different fields in my table, one is a 2 digit number field, one
is
a 3 digit autonumber that starts at 001, and the last is a 2 character
text
field. I need to concatenate these along with some special characters
example: 04-001-AH to show up on my form. My problem is I can't get
the
autonumber field to show the preceding zeros in the concatenation. I
formatted it on it's own in my table as 000 but with the concatenation it
just goes back to not showing the preceding zeros.
 
Back
Top