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

ascii format messed up in text file

Status
Not open for further replies.

newnoviceuser

Programmer
Jan 4, 2003
63
US
im using output to to send a file to a txt file here is the code

DoCmd.OutputTo acReport, "rptDailyTransactions", "MS-DOSText(*.txt)", "c:\daily", False, "", 0
DoCmd.OutputTo acReport, "RTRANS", "MS-DOSText(*.txt)", "c:\rtrans", False, "", 0
DoCmd.OutputTo acReport, "rptcashsheet", "MS-DOSText(*.txt)", "c:\sheet", False, "", 0
DoCmd.OutputTo acReport, "qryincomeexpense", "MS-DOSText(*.txt)", "c:\incexp", False, "", 0
the reports are clean and straight but when i ouput to a text file they are very misaligned in the text file. what changes can i make to align everything.
 
Try this, it may work,

Code:
DoCmd.OutputTo acOutputReport, "rptDailyTransactions", acFormatTXT, "C:\daily.txt"

Hope it helps you...

Regards,
 
the results are the same moves my data all over puts blank lines in it and drops off a couple of my fields.
is there any way i can export all the reports to the same file? rather than 4 different files?
 
I dont think it is possible to export 4 reports to a single file.

One way you can workaround is after 4 reports are exported to 4 files. You can add few more lines of code to merge them into one file like.

Code:
Open "c:\daily" For Append As #1
Open "c:\rtrans" For Input As #2
While Not EOF(2)
    Line Input #2, CurLine
    Print #1, Curline
Wend
Close #2

Open "c:\sheet" For Input As #2
While Not EOF(2)
    Line Input #2, CurLine
    Print #1, Curline
Wend
Close #2

Open "c:\incexp" For Input As #2
While Not EOF(2)
    Line Input #2, CurLine
    Print #1, Curline
Wend
Close #2
Close #1
 
I had already tried that but in text it continues to be sparatic and in rtf even if i add them together it still only shows the first page. html works but when the reports are big it makes multiple pages. so its much harder to merge them. if i couls merge the rtf's in vba that would be perfect. any sugestions?
 
Lets Create a New Blank Report and
Place the existing four reports as SubReport.

(Here you may need to work-up a bit on the design aspect.)

Now lets view the report, If all 4 reports appear properly,
then exporting it to rtf would actually export all the 4 reports to the rtf file directly.

See if it work, Its just a concept.

Regards,
 
thanks for the response i began trying that but some of the reports already have sub reports so things began to get complicated. this was my solution. i will print it because ive seen several people question the subjects here.
i used the outputto to rtf files then used the suggestion above for merging but it only printed the first report so this is the code I made to merge them together.
Open "c:\rtrans" For Input As #1
Do While Not EOF(1) ' Loop until end of file.
Line Input #1, TextLine ' Read line into variable.
If InStr(1, TextLine, "{\rtf1") > 0 Then
TextLine = Mid(TextLine, 2, Len(TextLine))
End If
If InStr(1, TextLine, "}}}") > 0 Then
TextLine = Mid(TextLine, 1, Len(TextLine) - 3) + "}}{\page}"
End If
Print #2, TextLine '
Loop
Close #1
Open "c:\sheet" For Input As #1
Do While Not EOF(1) ' Loop until end of file.
Line Input #1, TextLine ' Read line into variable.
If InStr(1, TextLine, "{\rtf1") > 0 Then
TextLine = Mid(TextLine, 2, Len(TextLine))
End If
If InStr(1, TextLine, "}}}") > 0 Then
TextLine = Mid(TextLine, 1, Len(TextLine) - 3) + "}}{\page}"
End If
Print #2, TextLine '
'Debug.Print TextLine ' Print to the Immediate window.
Loop
Close #1
you can merge as many reports as you like there are to intr command put the 1st one in the first file command and the second in the last file and both in any file in between. BUT!!!! make sure all files use the same fonts or you will have a headache i had to go back and change all fonts of my reports. thanks for the input
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top