CODE NEEDED -Remove leading zero

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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)
 
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.
 
Back
Top