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

Controlling spacing in an exported .txt file.

Status
Not open for further replies.

cwhite23

Technical User
Sep 17, 2003
66
US
Here's one for all you gurus out there! We do a lot of work with the Federal government and as a result, we have to do things their way. One of the things that they require is that for each order that comes in, we have to send a response back to them. The response is always in an 80 column line format. Does anyone have any ideas on how to control the output from VBA to a text file so that specific information will always end up at the right space on the line? For example, the Supplementary Address should always start at position 45 in the 80 column format. I've already gotten the data together and can concatenate it, but how do I control what goes where if the data lengths are variable? Any help would be greatly appreciated.
 
I think u can use the SPACE(n) or similar function under MS Access to imbed blanks within a string. You can derive the n value based on the Len() versus the fixed length of 80? htwh,



Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
Have a look at the formatting in the following string -

strLine = strLine & Format(rst!ToPayee, "!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")

It worked in Access 97 but I have not tried in the later versions. The code was written about 5 years ago for data to banks.
 
I forgot to supply the reference. Search the Help in the VB window for "User-Defined String Formats (Format Function)" because there are others you can use also.
 
actually, I ended up using the TAB command and it worked perfectly. Thanks everyone.
 
Ok, I found my code. I created a field called Count, and then created a text box that used a SPACE() to pad the report form to force data to another page based on Count.

=IIf(Count([LoanNo])>20,Space(5000),Space(1))

Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top