Converting numeric state postal code to 2 digit text

T

tbmarlie

I'm trying to convert a state postal number that is of type integer
into a text that needs to be two digitits so it will have a leading
zero if the state is only 1 digit. So, I'm trying to do 2 things at
once 1) convert the integer to string and 2)pad with a leading zero if
the number is only one character. I think I'm close and I've tried
different variations, but just can't quite get it. Here is what I
have so far:

Left((Left(CStr([State Num])),2 & "00"),2)
 
M

Marshall Barton

tbmarlie said:
I'm trying to convert a state postal number that is of type integer
into a text that needs to be two digitits so it will have a leading
zero if the state is only 1 digit. So, I'm trying to do 2 things at
once 1) convert the integer to string and 2)pad with a leading zero if
the number is only one character. I think I'm close and I've tried
different variations, but just can't quite get it. Here is what I
have so far:

Left((Left(CStr([State Num])),2 & "00"),2)

Looks like your )) are in the wrong place.

OTOH, this might do the same thing:
Format([State Num], "00")
 

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