how do you save a file with the date automaticly

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

Guest

I export and save files everyday to send to clients and was wondering how you could add the date of the file to the file name. I have the export written in VBI

Thanks
 
I export and save files everyday to send to clients and was wondering how you could add the date of the file to the file name. I have the export written in VBI.

Thanks
With the current date?
You haven't said what method you are using, so the best I can do is
tell you to concatenate the file name with the date:
"FileName" & Format(Date,"mmddyyyy")
becomes
FileName06022004
 
Thank you for your reply. I have taught myself access out of
neccessity so any help would be greatly appriciated. This is what
I have done. This works but I have to go and add the date manually
to the file name. I know this can be automated.

DoCmd.OutputTo acQuery, "Query name", "MicrosoftExcel(*.xls)",
"C:\Documents and Settings\Owner\Desktop\COMPLETED
REPORTS\filename.XLS", False, ""

DoCmd.OutputTo acOutputQuery, "Query name", acFormatXLS,
"C:\Documents and Settings\Owner\Desktop\COMPLETED REPORTS\
YourFileNameHere" & Format(Date,"mmddyyyy") & ".XLS"

Note the use of the acOutputQuery and the acFormatXLS constants.
Change "Query name" to the actual name of the query to be exported.
Change YourFileNameHere to the actual name of the file.
No need for the final False argument as False is the default, and if you don't use the
Template argument you don't need the "" so you can simply omit
everything after the ".XLS".
 
Back
Top