473,383 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Include todays date as part of file name

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
2 38345
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Gerry Viator | last post by:
Hi all, I have a textbox were a time is typed in like: upto 4 numbers 1900 300 1000 1425 I would like as they type the text to show todays date plus the time they
1
by: steven virnig | last post by:
We have an application group that wants to pull date from SQL Server and write it to text file on the server. They want the file format to be 12100_YYYMMDDHHMM.fr1 for one set of data,...
2
by: rxfrenc | last post by:
Hello- I have a problem trying to transfer text to a file. I need to include periods (.) in the file name, but it keeps changing them to pound signs (#). Here is what I have in the 'File Name'...
5
by: Vayse | last post by:
In VB6, I would have used Date() That no longer works. How do I find todays date in VB.net?
2
by: Drum2001 | last post by:
Hello, I am having isues with the following: I have two forms, a MAIN FORM with a SUB FORM: Within the MAIN FORM, I have an unbound textbox (Date Format) and a command button. Onload, the...
2
by: mamin | last post by:
I have a table that I need to export out to a text fiel, without column headers. I also need to have the file name include currernt date. Can anyone help me? I'm using the following code: ...
3
by: jonosborne | last post by:
Hi guys, im a bit of a novice being thrown in at the deep end ! Using MS Access 97 i have a table with data that is updated once a day from an Excel spreadsheet. I need a way of identifying when data...
5
by: nkechifesie | last post by:
Hi, I have written a VBA program that runs on Excel and puts data on the excel sheet. This runs everyday. I want to be adding the dates to the files, this date is gotten from the excel sheet that...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.