how to suppress leading zeroes

K

kwizzy

I have a table with a text key in the fixed format "annn" and I need to
sometimes display it as "a n" (where n can be 1, 2 or 3 digits) whilst
maintaining the original field for sort purposes. I can separate the two
parts easily enough and put back together with a space between, but I cannot
see how to display the numeric part as a number without leading zeroes. Is
this because it is text? Any ideas?
 
F

fredg

I have a table with a text key in the fixed format "annn" and I need to
sometimes display it as "a n" (where n can be 1, 2 or 3 digits) whilst
maintaining the original field for sort purposes. I can separate the two
parts easily enough and put back together with a space between, but I cannot
see how to display the numeric part as a number without leading zeroes. Is
this because it is text? Any ideas?

[fieldname] = "A0023"

Val(Right(FieldName],4)) = 23
 
M

Marshall Barton

kwizzy said:
I have a table with a text key in the fixed format "annn" and I need to
sometimes display it as "a n" (where n can be 1, 2 or 3 digits) whilst
maintaining the original field for sort purposes. I can separate the two
parts easily enough and put back together with a space between, but I cannot
see how to display the numeric part as a number without leading zeroes. Is
this because it is text?

Yes it is because it's text. Just convert the second part
to number

part1 & " " & CLng(part2)
 
K

kwizzy

ta muchly

fredg said:
I have a table with a text key in the fixed format "annn" and I need to
sometimes display it as "a n" (where n can be 1, 2 or 3 digits) whilst
maintaining the original field for sort purposes. I can separate the two
parts easily enough and put back together with a space between, but I cannot
see how to display the numeric part as a number without leading zeroes. Is
this because it is text? Any ideas?

[fieldname] = "A0023"

Val(Right(FieldName],4)) = 23
 

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