Naming files using date string using OutputTo

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

Guest

I'm sure this is easy but, using the OutputTo command I am outputting several
queries as spreadsheets. That is so easy, even I can do it! What I am
struggling with is incorporating the current week number in the file name as
I export weekly and don't want to overwrite each file each week.
e.g. to name a file Sales_PerformanceWk46.xls where "46" will automatically
vary each week and thus become Sales_PerformanceWK47.xls next week.

Thanks,

MH
 
DoCmd.OutputTo acOutputQuery, _
"qryMyQuery", _
acFormatXLS, _
"C:\Temp\Sales_PerformanceWk" & DatePart("ww", Date) &
".xls"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Thanks Graham.
I was close but couldn't get the format right. I was placing " " incorrectly.
 

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

Back
Top