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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Fixed length of field...pad text with spaces.

Status
Not open for further replies.

Dirtbike

IS-IT--Management
Dec 9, 2002
81
US
I have a need to result a field with a fixed length. My part numbers have between 2 and 20 characters. My FoxPro program expects the fields to be exactly 20 characters in length. I export from Access and import into Fox. What is an easy way to "pad" the part number with trailing spaces?

I have been using Excel to force the field to be 20 char, then doing a "save as" a ".prn" file. I rename the *.prn to *.txt and the FoxPro program, seeing each record has exactly 96 bites, imports it into my high density inventory carosel.

I'm sure I need to do some string length calculations but I don't know how to code the trailing spaces based on the string length difference from 20.

Thanks a bunch for your help here.

Scott in Charlotte, NC
 
Something like this in a query ?
PaddedZone: Right(Space(20) & [Field name], 20)
If JetSQL choke on Space(20), replace it with " "

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top