By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 968 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

Include todays date as part of file name

P: n/a
Using a macro to output a query to an Excel file.
Is there a way to automatically add todays date in the file spec?
As: C:\Access Data\[filename] & todays date.xls

Chuck
....
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mon, 19 Jul 2004 12:20:50 -0400, Chuck wrote:
Using a macro to output a query to an Excel file.
Is there a way to automatically add todays date in the file spec?
As: C:\Access Data\[filename] & todays date.xls

Chuck
...


Try these.

If [FileName] is a field in a table:
"c:\Access Data\" & [FileName] & Date() & ".xls"

If [FileName] is a generic text name:
"c:\Access Data\Expenses" & Date() & ".xls"
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2

P: n/a
On Mon, 19 Jul 2004 18:18:21 GMT, fredg <fg******@example.invalid> wrote:

fredg,

Thanks for your help.
On my first attempt Access said it could not save the file. None of the
reasons were applicable. When the macro stopped it showed the date as:
mm/dd/yyyy. I think it was the slashes in a file name that was the problem.
I changed the *&Date()* to * & (Format(Date(),"yymmdd") and it is working fine.
I choose the date format so that the stored files would display sorted
chronologically.

Thanks again.

Chuck
....

On Mon, 19 Jul 2004 12:20:50 -0400, Chuck wrote:
Using a macro to output a query to an Excel file.
Is there a way to automatically add todays date in the file spec?
As: C:\Access Data\[filename] & todays date.xls

Chuck
...


Try these.

If [FileName] is a field in a table:
"c:\Access Data\" & [FileName] & Date() & ".xls"

If [FileName] is a generic text name:
"c:\Access Data\Expenses" & Date() & ".xls"


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.