Output to - Adding a date to the Output File Argument

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

Guest

Hi there

I use a macro with an 'Output To' statement that exports my reports as RTF
files witha name I've hard coded in.
Is there a way that I can generate the current date into that name so the
files are their hardcoded name+the current date ?

ie =(name)+NOW()

Somethinglike that anyway. A word around is acceptable if it cannot be done
within the Output to's Outp0ut file argument

tia
 
Tim,

AFAIK this cannot be done in a macro. It's a piece of cake in VB code
though! I suggest you convert your macro to code (if you are not into coding
yet), open the module, find the line that looks like:

DoCmd.OutputTo acTable, "SomeTable", "RichTextFormat(*.rtf)",
"SomeFileName.txt", False, ""

and modify to:

DoCmd.OutputTo acTable, "Countries", "RichTextFormat(*.rtf)",
"SomeFileName " & Now() & ".txt", False, ""

(note: all in one line, in case it gets wrapped in the posting).

Then run this function instead of the original macro, by using a RunCode
action in another macro, calling the function in the converted macro module,
or by means of a command button on a form.

HTH,
Nikos
 
Timbob,

Well, it is almost as you said :-) In the Output File argument of your
macro, put the equivalent of...
="C:\YourFolder\FileName" & Format(Date(),"yymmdd") & ".rtf"
 
Back
Top