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!

Add leading 0's to a Field

Status
Not open for further replies.

hribrad

Technical User
Jul 23, 2002
2
CA
I have to import a file from an AS/400 into an Access database. In the database I must format some of the fields so that if the length of the data is not using the full length of the field leading 0's must be added. How can I automate this since their can be thousands of records. I then export this table as a text file to sent to another company that imports it into a different system.
 
Boy, if THIS doesn't sound familiar. What I would use, is a simplified code:

Field1 = String(LengthOfField-Len([ImportedValue]),"0") & ImportedValue

This is based on a query. You would have to change the "ImportedValue" and probably remove the brackets for any other kind of code.

HTH! Roy McCafferty
aka BanditWk

Las Vegas, NV
roy@cccamerica.org
RLMBandit@aol.com (private)

"I do this because I know I can - no need to send gifts - just send me a smile to show me that I've helped." ~ seen on a cardboard sign held by Roy McCafferty on a corner in Las Vegas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top