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

How to create a text file for a report? 1

Status
Not open for further replies.

ffleitas

Technical User
Mar 15, 2001
85
US
Hello programmers,

I would like to create in my visual basic portion:
DoCmd.OpenReport "rptInvoiceTotal", PrintMode, , strWhereClient2

a command that would create this report "rptInvoiceTotal" as a text file on my c-drive. ex. c:\ftpscript.txt

Thanks,
Felix
 
Hi,
Here is some code that will write to a text file. This code can be placed in a module. So, this does not use the Report object in Access, since you will lose all the formatting, fonts, etc., when it becomes a text file.

Open "c:\ftpscript.txt" For Output As #1
For Each Fld In qry.Fields
Write #1, " - - " & Fld.Name & ", " & Fld.SourceTable
Next Fld
Close #1

This is a very simple example. You will need to loop through your recordset, and do your own formatting. But, this will give you a basic idea of where to begin.
HTH, [pc2]
Randy Smith
California Teachers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top