Output Report: File Name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to incorporate a formatted date (YYYYMMDD) along with the
report name when using the OutputTo command? I have a "Sales Snapshot"
report, and would like to run it weekly where it saves to a directory as
20041112-SalesSnapshot.rtf

Bernie
 
Bernie,

Not easy in a macro, but a piece of cake in VB code. If you don't feel
comfortable with VB code then just make the basic macro, save it and convert
it to code:

Tools > Macro > Convert Macro to Visual Basic

Next, go to Modules and open the one called Converted Macro - YourMacroName
and locate the line that looks like:

DoCmd.OutputTo acReport, "Sales Snapshot", acFormatRTF, "SomeFileName.rtf",
False, ""

Replace that with:

fName = "C:\SomeFolder\...\ReportFileName " & Format(Date, "yyyymmdd") &
".rtf"
DoCmd.OutputTo acReport, "Sales Snapshot", acFormatRTF, fName, False, ""

Run the code and the job is done.

HTH,
Nikos
 
Back
Top