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

DoCmd Output (Append?)

Status
Not open for further replies.

dandough

Technical User
Dec 6, 2003
12
CH
Hi All,

I would like to loop through a list which would output a report to a file for each iteration. How could I append the file instead of having it over written?

Public Sub OutputReport()

DoCmd.OutputTo acOutputReport, "Report1", acFormatRTF, "C:\temp\MyDatabase.rtf"

End Sub

Thanks,
Dan
 
Hi!

You say you do this thru iteration. One suggestion would be to pass a counter to this sub (or if you're using recordset, perhaps the .absoluteposition of the recordset) and apply it to the filename:

[tt]Public Sub OutputReport(ByVal lMyNo as Long)
DoCmd.OutputTo acOutputReport, "Report1", _
acFormatRTF, "C:\temp\MyDatabase" & lMyNo & ".rtf"
End Sub[/tt]

This would still overwrite previously saved files, but try playing around with this number idea, and see if it's appliccable to your challenge...

HTH Roy-Vidar
 
Oups - posted without reading completely (or understanding) sorry... My thingie there would only provide new files... Roy-Vidar
 
Thanks All,

Manipulating the query got me the information I needed for my report into one table which was basically a table sort:

SELECT [Investors Sort].Investor, [2003].Manager, [2003].[Capital Introduction Referrals], [2003].["One on One" Manager Meetings], [2003].[Capital Introductions Event "Manager Sessions" Attended]
FROM [Investors Sort] LEFT JOIN 2003 ON [Investors Sort].Investor = [2003].Investor;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top