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

show current date in export txt file name

P: 9
I'm using a macro to transfer a table to txt file, which is fine but I want to run it each day (as the table contents change) and include the date in the filename without having to manually rename each time. It's infuriatingly simple but beyond my beginner's grasp. Can anyone help? I'm using Access 2000.

(I posted this in Articles section by mistake- apologies)
Aug 10 '07 #1
Share this Question
Share on Google+
2 Replies


missinglinq
Expert 2.5K+
P: 3,532
As is the case with many of us here, I seldom use macros. To do this in code would be something like this
Expand|Select|Wrap|Line Numbers
  1. TheDate = Month(Date) &"-" & Day(Date) & "-" & Year(Date)
  2. TheFile = CompletePathAndFileName & TheDate & ".txt"
  3. DoCmd.OutputTo acOutputTable, "YourTableName", acFormatTXT, TheFile, False, ""
I think in a macro it would be something like this:
Expand|Select|Wrap|Line Numbers
  1. CompletePathAndFileName & Month(Date) & "-" & Day(Date) & "-" & Year(Date) & ".txt"
Welcome to TheScripts!

Linq ;0)>
Aug 10 '07 #2

P: 9
As is the case with many of us here, I seldom use macros. To do this in code would be something like this
Expand|Select|Wrap|Line Numbers
  1. TheDate = Month(Date) &"-" & Day(Date) & "-" & Year(Date)
  2. TheFile = CompletePathAndFileName & TheDate & ".txt"
  3. DoCmd.OutputTo acOutputTable, "YourTableName", acFormatTXT, TheFile, False, ""
I think in a macro it would be something like this:
Expand|Select|Wrap|Line Numbers
  1. CompletePathAndFileName & Month(Date) & "-" & Day(Date) & "-" & Year(Date) & ".txt"
Welcome to TheScripts!

Linq ;0)>

thanks for the welcome Linq (and the answer of course).
I'll give the code a try seems like a good time to start.
Aug 10 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.