Leading Zeroes

  • Thread starter Thread starter Gregg
  • Start date Start date
G

Gregg

I am appenidng data from one table to another and am
trying to remove leading zeroes so that data that looks
like "000038150" appends as "38150". How do I do this?
Does it matter what type of field this is (Text, Number,
etc.)?

Thanks for you help.
 
Well, number fields are stored without leading zeroes.

You could use a calculated field to get the desired value.

Val(SomeField) should strip off any leading zeroes in a string.
 
I am appenidng data from one table to another and am
trying to remove leading zeroes so that data that looks
like "000038150" appends as "38150". How do I do this?
Does it matter what type of field this is (Text, Number,
etc.)?

Yes, it does matter. A Number datatype is stored as binary bits, not
as decimal digits; it can be formatted to display leading zeros but
they're not stored. If you won't be doing math with the field, use
Text; if you will, store the result in a Long Integer number field.

Or you can store it as Text with the leading zeros trimmed off by
appending a calculated field:

CStr(CLng([fieldname]))

to convert the text digits to a Long and then back to string, losing
the zeros in the process.
 
Back
Top