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.
 
Back
Top