Help with automating file name

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

I have the following code that exports the below query to excell. I would
like the files name to include the month and date. How would I format this?

DoCmd.OutputTo acOutputQuery, "qryShopOrderSqFtShippedSummaryExport",_
acFormatXLS, "W:\Cokato\Production\ProdRoomRpt.xls"
 
6

'69 Camaro

Hi, Matt.
I would
like the files name to include the month and date.

Uh, . . . the date _always_ includes the month, unless you're referring to a
different calendar than the rest of us normally use. Perhaps you mean the
month and day? If so, try:

DoCmd.OutputTo acOutputQuery, "qryShopOrderSqFtShippedSummaryExport",_
acFormatXLS, "W:\Cokato\Production\ProdRoomRpt_" & _
Month(Date()) & "_" & Day(Date()) & ".xls"

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
T

takzie

mattc66 said:
I have the following code that exports the below query to excell. I would
like the files name to include the month and date. How would I format this?

DoCmd.OutputTo acOutputQuery, "qryShopOrderSqFtShippedSummaryExport",_
acFormatXLS, "W:\Cokato\Production\ProdRoomRpt.xls"

Hi Matt,

try this:

DoCmd.OutputTo acOutputQuery, "qryShopOrderSqFtShippedSummaryExport",_
acFormatXLS, "W:\Cokato\Production\ProdRoomRpt "&format(now(),"mmm dd")&".
xls"

You may want to play with the date formatting to display the desired date
format that you want.

Hope this help.
 

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