I have a table with a column that contains 3 digit zip codes stored as text, and some of them are stored as 2 digit zips because leading zero is missing. I want to add the missing leading zeros for 2 digit zips.
I tried the query below but got a lot of errors and the result was not accurate. Should it be written with an if statement checking if the length is 2 characters then concatenate with 0? Or some other way?
This is what I tried:
Update TABLE set ZIPS = string(3 - len(ZIPS),"0")
I had the following error message:
MS Access didn't update 1930 fields due to a type conversion failure, 0 records due to key violations, 0 records due to lock violations, o records due to validation rule violations.
ZIPS = "0" & ZIPS WHERE Len(ZIPS)=2. If you want to use String():ZIPS = String(3 - len(ZIPS),"0") & ZIPS. - June7