How to add leading zeros to split field string

C

CS

How do I add leading zeros to this?

BLDG: Mid([LOCATION],InStr([LOCATION],"-")+1)

Please help.
 
M

Marshall Barton

CS said:
How do I add leading zeros to this?

BLDG: Mid([LOCATION],InStr([LOCATION],"-")+1)

How many zeros? If its alway the same number:
BLDG: String(howmany, "0") & Mid(LOCATION, InStr(LOCATION,
"-") + 1)

If you want to pad it out so the result is a specific
length:

BLDG: Right(String(99, "0") & Mid(LOCATION,
InStr(LOCATION, "-") + 1), specificlength)
 
K

KARL DEWEY

My response yesterday --
Left([YourField], InStr([YourField], "-")-1) & Right("00000" &
Mid([YourField], InStr([YourField], "-")+1, 5)
 

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