[AccessD] Output Larg Text File

Stuart McLachlan stuart at lexacorp.com.pg
Thu Sep 16 08:25:53 CDT 2004


On 16 Sep 2004 at 12:55, Mark A Matte wrote:

> Hello All,
> 
> In A97 or A2k...I have a large report(>60,000 record and >11,000 Pages)...I 
> need to save this as a text/rtf/something...everytime I try...I get an "over 
> flow" error...any suggestions?
> 

How complex is the report?

In this sort of situation, you are often better opening a text file for 
output, opening the underlying recordset,stepping through the records and 
writing out the rows. Something like:


Dim rs as Recordset
Set rs = CurrentDb.OpenRecordset("myquery")
Open "myFile.txt" for Output as #1
While not rs.eof
   Print #1, rs(0) & "," & rs(1) & "," & rs(2).....
Wend
Close #1

You can do as much formatting as you like for individual rows using various 
string manipulation functions,  and by checking for changes in header 
fields you can throw headers rows as required.

I did the same thing today to replace a "Docmd.OutputTo" to generate a web 
page. Writing the raw HTML directly to a file, gave me much better control 
over the layout of the resulting page and ran about 20 times faster  than 
trying to Output a report to HTML.







-- 
Stuart





More information about the AccessD mailing list