Report Export to Text File

  • Thread starter Thread starter Steve in S.F.
  • Start date Start date
S

Steve in S.F.

I have a report that consists of just a detail line and a footer line. I need
it as a straight ascii text file. I use the "OutputTo" action to export it
to a text file, but doing that results in a Carriage Return/Line Feed between
each line of the report in the text file.

Is there any way to prevent that from happening either through formatting of
the report or some other method?

Thanks,

Steve
 
Try set the detail height to about 1/8" and don't allow it to grow.

Normally I would just use some other method to export a query or code with a
recordset.
 
"was able to get rid of about 1/2 the CR/LF. Weird' make sure the font size
is small.
 
this "OutputTo" is VERY bugged. it also sometimes "loses" or inverts lines at
end of "preview page".
If you really want to get rid of the empty lines AND have all your data,
I'd rather design and output the report with plenty of extra space and then
run a little vba code to clean up the generated txt file from its empty lines
(using good old PRINT# and INPUT#).
That's quick to do, quick to run AND reliable.
 
I did that and have gotten it to where there's only a few CR/LFs. Still
working on it. Thanks
 
Sorry, I'm not really a programmer. Could you give me an example of what
that might look like?

Thanks.
 
Could be something like this (might require some debugging):

Option Explicit
Sub CleanupTxtFile(strFileName As String)
'read lines from strFileName file
'writes non blank lines to strFilename.out
'quickly written and NOT TESTED by Patrick Honorez - www.idevlop.com
Dim strLine As String
Open strFileName For Input As #1
Open strFileName & ".out" For Output As #2
Do Until EOF(1)
Input #1, strLine
strLine = Trim(strLine)
If Len(strLine) > 0 Then
Print #2, strLine
End If
Loop
Close #1
Close #2

End Sub

Regards,
Patrick
 
Thanks for you work on this. Maybe I didn't implement it correctly but it
actually resulted in an output file with MORE CR/LFs and other oddities.

Steve
 
Back
Top