CODE NEEDED -Remove leading zero

G

Guest

I have a database with a primary key of customer number that I have set to a
field size of 5. There are already a few reocrds in the table which is also
link to several other tables. I received a list of current customers to
import but the customer numbers all have 1 leading zero in front of the
customer number(some have several zero's which begin the customer number as
well.)

I am needing the code to remove only the first zero using an update query or
other.

any help would be greatly appreciated.
 
R

Rick B

Is this a number field or a text field? If number, then leading zeros are
not relevant. "0001" is the exact same thing as "1" if it is a number
field.

If a text field, and you only want the right five digits, just use the
"Right" function. This could be done in an update query to replace the
current field entry with only the right five digits.


=Right([YourFieldName],5)
 
G

Guest

Thank you Rick, that did the trick.

BDPIII

Rick B said:
Is this a number field or a text field? If number, then leading zeros are
not relevant. "0001" is the exact same thing as "1" if it is a number
field.

If a text field, and you only want the right five digits, just use the
"Right" function. This could be done in an update query to replace the
current field entry with only the right five digits.


=Right([YourFieldName],5)



--
Rick B



BDP III said:
I have a database with a primary key of customer number that I have set to
a
field size of 5. There are already a few reocrds in the table which is
also
link to several other tables. I received a list of current customers to
import but the customer numbers all have 1 leading zero in front of the
customer number(some have several zero's which begin the customer number
as
well.)

I am needing the code to remove only the first zero using an update query
or
other.

any help would be greatly appreciated.
 

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