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

OutputTo method and save the file by date 1

Status
Not open for further replies.

mmaginniss

Technical User
Jun 9, 2003
20
US
I have automated the task of ouptutting a report to a file on the network using the OutputTo method but now management wants me to save the file by date - so that they can see the changes in the report based on what day it was generated. Here's my current code (I changed the location to my desktop for this example):

Function cmdCITReport()

Dim stDocName As String

stDocName = "rptCITPriority"
DoCmd.OutputTo acReport, stDocName, acFormatRTF, "C:\Documents and Settings\atp2mxm\Desktop\cmdRpt.rtf"

End Function

What I would like is for it to output cmdRpt_ddmmmyy.rtf with ddmmyyy being the date the report was generated. Then every time the report is generated it would create a new file. Any ideas? Thanks.
 
DoCmd.OutputTo acReport, stDocName, acFormatRTF, "C:\Documents and Settings\atp2mxm\Desktop\cmdRpt.rtf" & Date()
 
or specifically

DoCmd.OutputTo acReport, stDocName, acFormatRTF, "C:\Documents and Settings\atp2mxm\Desktop\cmdRpt.rtf" & Format(Date, "ddmmmyy")
 
Thanks for responding. You're close, but I get a file CMDRpt.rtf31Jul03 which cannot be opened. It's like I want to stick the date before the .rtf ending.
 
sorry its meant to be

DoCmd.OutputTo acReport, stDocName, acFormatRTF, "C:\Documents and Settings\atp2mxm\Desktop\cmdRpt" & Format(Date, "ddmmmyy") & ".rtf"

this will do it :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top