473,395 Members | 2,192 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,395 software developers and data experts.

DoCmd.OutputTo - How can I add the date to my document name?

94
I am exporting snaphot files on 1st of each month. I want each file i export to automatically insert the current date.

I have set the current date to a variable named DateTime and tried inserting this into my export string but it didn't like this... see below....

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acOutputReport, "Employer Funding Report (By Employer)", "Snapshot Format", "c:\my documents\siobhan\testsnapshot"&DateTime&".snp"
Anyone have any other suggestions???
Feb 12 '08 #1
5 7536
puppydogbuddy
1,923 Expert 1GB
I am exporting snaphot files on 1st of each month. I want each file i export to automatically insert the current date.

I have set the current date to a variable named DateTime and tried inserting this into my export string but it didn't like this... see below....

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acOutputReport, "Employer Funding Report (By Employer)", "Snapshot Format", "c:\my documents\siobhan\testsnapshot"&DateTime&".snp"
Anyone have any other suggestions???
Try this:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acOutputReport, "Employer Funding Report (By Employer)", acFormatSNP, "c:\my documents\siobhan\testsnapshot" & CStr(DateTime) & ".snp", False
Feb 12 '08 #2
Lewe22
94
It doesn't like it.....am getting a VB run-time error '2024'

"The report snapshot was not created because you don't have enough free disk space for temporary work files."

Yet when i run the simple....

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acOutputReport, "Employer Funding Report (By Employer)", "Snapshot Format", "c:\my documents\siobhan\Employer Funding Report (By Employer).snp"
....it works.

I am the administrator of mp PC and i have plenty of free disk space on my c: drive.

I'm confused.....help!!
Feb 12 '08 #3
puppydogbuddy
1,923 Expert 1GB
It doesn't like it.....am getting a VB run-time error '2024'

"The report snapshot was not created because you don't have enough free disk space for temporary work files."

Yet when i run the simple....

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acOutputReport, "Employer Funding Report (By Employer)", "Snapshot Format", "c:\my documents\siobhan\Employer Funding Report (By Employer).snp"
....it works.

I am the administrator of mp PC and i have plenty of free disk space on my c: drive.

I'm confused.....help!!
do you have all of these directories set up on your computer:
"c:\my documents\siobhan\testsnapshot"

Try not having so many.....eliminate >>>>>\testsnapshot
Feb 12 '08 #4
Stewart Ross
2,545 Expert Mod 2GB
Appending the date directly or as a string will add the slash characters (e.g. 12/02/08 for UK dates formatted as today). These are illegal in the filename and will cause an error.

Use this format instead to append the date without the slash characters, year first then month then day: Format$(Date, "yymmdd")

Stewart
Feb 12 '08 #5
Lewe22
94
Thanks!

As suggested the problem was in the format of the date. My fix was...

Expand|Select|Wrap|Line Numbers
  1. 'LOAD CURRENT DATE TO VARIABLE - IN FORMAT dd-mm-yyyy
  2. Date1 = Format(Date, "dd-mm-yyyy")
  3.  
  4. 'Save Report
  5. DoCmd.OutputTo acOutputReport, "Employer Funding Report (By Employer)", acFormatSNP, "c:\my documents\siobhan\Employer Funding Report (By Employer)" & Date1 & ".snp"
Feb 13 '08 #6

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

Similar topics

2
by: deko | last post by:
This code is behind a button that exports the contents of a query ("qryXL_Tx") to an Excel spreadsheet. It works fine the first time, but will not run a second time. When I go to look at my...
0
by: Frank Barnhart | last post by:
We have an application which runs Access under automation. With Access 97, the app included this line to send a report to a text file: myAccessObject.DoCmd.OutputTo acOutputReport, ,...
0
by: Robert Langen | last post by:
I'm calling an Access XP application from an Outlook XP appointment form. Everything works, but the lines DoCmd.OutputTo acOutputReport, "testreport", acFormatRTF, "c:\test.rtf", False Docmd.Quit...
4
by: tmountjr | last post by:
I've got a user who's trying to export a text file with unicode formatting. When he exports it as straight ascii, some of the foreign characters (mostly just accent marks and the like - no...
1
by: Ryan | last post by:
Hello. I was hoping that someone may be able to assist with an issue that I am experiencing. I have created an Access DB which imports an Excel File with a particular layout and field naming. ...
3
by: ljungers | last post by:
I need to make some changes to a Query/select/print report using word application. What I need to do is change the way Word is called yet keep the process the same. Word is used so changes can be...
1
by: Simon | last post by:
Dear reader, With the DoCmd.OutputTo ...... you have the possibility to write a report to an external location. In case the external location is an existing file the DoCmd is not...
2
by: jmartmem | last post by:
Greetings, I have several Access 2007 reports that I regularly export to individual PDF flat files on a web server. I've successfuly created a module sub to export the reports using the...
16
by: g diddy | last post by:
Hi, I have used the Docmd.outputto function in various places in my code but for some reason all code that comes afterwards, even msgbox doesn't show. I was just wondering if there is anything that...
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.