473,748 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to automatically run DoCmd.OutputTo on daily basis

87 New Member
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 DoCmd.OutputTo Macro action, but I can't seem to figure out how to run the macro automatically.

I can succesfully run the macro below manually (without the IF statements), but have yet to make it work with the IF statement. Ideally, the macro will run automatically at 12:00 noon daily whether or not I have the database open (preferably not).

Here's the code for what I have so far:

Expand|Select|Wrap|Line Numbers
  1. Sub Report_Export()
  2. If Format(Now(), "hh:mm") = "12:00" Then
  3. 'Now() = Current Date/Time
  4. 'Time set for 12:00 noon
  5. DoCmd.OutputTo acOutputReport, "SSP&A ROADMAP", acFormatPDF, "http://(web server address)/ez/Documents/SSP&A%20ROADMAP.pdf", False, , , 0
  6. DoCmd.OutputTo acOutputReport, "Ready to Launch Report_EZLC", acFormatPDF, "http://(web server address)//ez/Documents/Ready%20to%20Launch%20Report_EZLC.pdf", False, , , 0
  7. DoCmd.OutputTo acOutputReport, "Ready to Launch Report_PFIT", acFormatPDF, "http://(web server address)//ez/Documents/Ready%20to%20Launch%20Report_PFIT.pdf", False, , , 0
  8. End If
  9. End Sub
I'd appreciate guidance from anyone who can help me.

Regards,

JM
Aug 1 '08 #1
2 3763
ADezii
8,834 Recognized Expert Expert
  1. Set the Timer Interval Property of the Form to 60000 (1 minute).
  2. Place your code in the Timer() Event of the Form.
  3. Every Minute the code in the Timer () Event will be executed, and when it is exactly !2:00 Noon, the criteria will be met, and the OutPutTo Actions will be initiated.
  4. P.S. - The 'Database' and 'Form' must be 'Opened'.
Aug 2 '08 #2
NeoPa
32,571 Recognized Expert Moderator MVP
Alternatively (perhaps a little more complex), design a database that opens a particular form automatically on opem. The code in the OnOpen event of the form does the work you need done and then closes the application.

Use standard Windows sceduling to invoke the database at noon every day and everything should work as required.
Aug 10 '08 #3

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

Similar topics

0
2268
by: Victor Kaiser | last post by:
I am using DoCmd.OutputTo to allow users to save Access reports in snapshot format or other desired formats. Once the user selects the desired format and clicks "OK", a dialog box appears that informs the user of the progress ("Now outputting page X of...to the file...") This is fine. However, the title of the dialog box is "Printing", which is misleading since the user isn't actually printing but rather is saving data to a file. Is there...
2
8051
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 query... it's blank! No SQL at all.... Any ideas why this sub is eating my query?? Private Sub cmdExportXL_Click() strXLfile = "Transactions_" & strTxType & strTxAcct & strQtr & strYr & ".xls"
0
3149
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, , acFormatTXT, "sample.txt" (The constant acOutputReport has the value of "MS-DOS Text (*.txt)". There is no object name in the command because the report is open at the time this line is executed.)
0
1596
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 produce Access hangs. That means, the file testreport.rtf is correctly created, but Access doesn´t quit. The process msaccess.exe stays and consumes 98% processor time. If I remove the OutputTo line, Access quits perfectly.
4
6284
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 non-roman characters that I can see) don't come through right. So he needs it in Unicode formatting. He's using code for the DoCmd.OutputTo command. There's a very undocumented Encoding option for that command, but no options are specified and there's...
7
2920
by: MLH | last post by:
A97 has menu options that support exporting table data to ms excel data file format. Is this easily implemented from within code? Any examples? I looked in A97 HELP for the TransferSpreadsheet Action but there was no example code (Example appeared at the top next to 'See Also' but it was grayed out).
1
5319
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. Next the user can go into a Form which basically a dynamic query with a friendly interface that eventually outputs a table that is stored in the DB as well as exported to a CSV file. The CSV file is then used with a vendor solution to fill in...
1
6296
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 responding with the warning "File already exist". The file will be overwrite without any warning even with the DoCmd.Setwarnings True in
16
4504
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 could be causing this. For example in the snippet below the docmd command brings up a box saying that it is outputting the file to c:\FullTimetable.snp but no msgbox appears saying "test". I have about 6 or so if statements with the same problem and...
0
8994
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9329
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8247
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4878
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.