Report Export to Text File

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
 
D

Duane Hookom

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.
 
S

Steve in S.F.

Duane:

That helped some -- was able to get rid of about 1/2 the CR/LF. Weird.
 
D

Duane Hookom

"was able to get rid of about 1/2 the CR/LF. Weird' make sure the font size
is small.
 
I

iDevlop

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.
 
S

Steve in S.F.

I did that and have gotten it to where there's only a few CR/LFs. Still
working on it. Thanks
 
S

Steve in S.F.

Sorry, I'm not really a programmer. Could you give me an example of what
that might look like?

Thanks.
 
I

iDevlop

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
 
S

Steve in S.F.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top