Output to - Adding a date to the Output File Argument

T

Timbob

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
 
N

Nikos Yannacopoulos

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
 
S

Steve Schapel

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top