Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

export query adding date to file name

Status
Not open for further replies.

626

IS-IT--Management
Aug 28, 2002
6
US
I'm trying to export a query to excel daily, and exporting is not the probelm, but I need the file name to have time stamped with the yyyy/mm/dd so as to avoid over writing the file everyday. Does some have any ideas

Thanks a lot
 
Use the Name command. You will need to execute the query from VB and then use the following command substituing the filenames

name "C:\test.txt" as "C:\test" & format(date,"yyyymmdd") & ".txt"

I would also recommend not putting slashes in the file name even if they are forward slashes. It could look confusing.
Pat B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top