Leading zeros in text field

T

Troy

Hello! I have a field in a table that is text type. I need to append leading
zero's to the left of the number so that the number is equal to 3 digits.

Example:
001
002
003
 
J

John W. Vinson

Hello! I have a field in a table that is text type. I need to append leading
zero's to the left of the number so that the number is equal to 3 digits.

Example:
001
002
003

You can do this in one swell foop using an Update query:

UPDATE yourtable
SET fieldname = Right("000" & [fieldname], 3)
WHERE Len([fieldname]) < 3;
 
T

Troy

You are GREAT! Thank You!!!

John W. Vinson said:
Hello! I have a field in a table that is text type. I need to append leading
zero's to the left of the number so that the number is equal to 3 digits.

Example:
001
002
003

You can do this in one swell foop using an Update query:

UPDATE yourtable
SET fieldname = Right("000" & [fieldname], 3)
WHERE Len([fieldname]) < 3;
 

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