Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stripping Leading Zero's

Status
Not open for further replies.

ellford

Programmer
Nov 19, 2004
13
US
I have a table with a field that has a number (stored as text as it's used to identify items and never used in calculations) that is a total of 18 characters long. The actual number that the user sees is 8 characters long. I need to strip out the first 10 digits in this field.

Anyone know how to do this?

Initially I tried changing the field size and format, but it stripped the last 10 digits (the important ones).
 
You may try to use the Val function to strip all the leading zeros or the Format function to get exactly 8 digits.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yeah I initially tried the val and format, but couldn't get it to work. As such I just created an update query that does this:

UPDATE tbl_accounts SET tbl_accounts.actnumber = Right([actnumber],8);

Works like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top