Adding date at the end of report name

G

Guest

Hi, need urgent help on the following topic:
I'm currently using the following code to create a report. How do I add the
current date at the end of the file name for every report created? So I can
distinguis them and to prevent overwriting them?

DoCmd.OpenReport "rpt_myreport", acViewPreview, , , acHidden
DoCmd.OutputTo acOutputReport, "rpt_myreport", "SnapshotFormat(*.snp)",
"C:\Reports\rpt_myreport.snp"
DoCmd.Close acReport, "rpt_myreport", acSaveNo


I would like to generate a report like "C:\Reports\rpt_myreport18-06-2007.snp"
Thanks
 
F

fredg

Hi, need urgent help on the following topic:
I'm currently using the following code to create a report. How do I add the
current date at the end of the file name for every report created? So I can
distinguis them and to prevent overwriting them?

DoCmd.OpenReport "rpt_myreport", acViewPreview, , , acHidden
DoCmd.OutputTo acOutputReport, "rpt_myreport", "SnapshotFormat(*.snp)",
"C:\Reports\rpt_myreport.snp"
DoCmd.Close acReport, "rpt_myreport", acSaveNo

I would like to generate a report like "C:\Reports\rpt_myreport18-06-2007.snp"
Thanks

DoCmd.OutputTo acOutputReport, "rpt_myreport",
"SnapshotFormat(*.snp)", "C:\Reports\rpt_myreport" &
Format(Date,'mm-dd-yyyy')" & ".snp"
 

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