Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How does one set up a macro to generate reports?

Status
Not open for further replies.

SeeWard

Programmer
Mar 21, 2005
89
US
Hi,
I was curious to know how one sets up a macro in Access to autorun reports at a specific time? I've not used macros in Access yet so please-if you can- be very detailed. Thank you...
 
Hi,
the best bet is to do the following.
1. Create a new database and link in the tables and queries required to create the report.
2. Create a form (call it frmStartUp or something similar)
3. In design view of the form, open the form properties dialogue
4.Click on the Events Tab, click into the Open Event.
5. Click on the ellipses (3 dots) to the right.
6. Select 'Code Builder'
7. Enter the following code:

DoCmd.OpenReport "YourReportNameHere",acViewNormal
Application.Quit

8. Save and close the form.
9. Go to Tools --> Startup
10. From the 'Display Form/Page' combo select the startup form.
11. Close the database.

Now every time you open that sepecific database, the report(s) will print and the Db will close. So
12. Create a scheduled task to open the database at the time you require to run the report.

HTH
Jim
 
I would just create an Autoexec macro with the OpenReport command. Look up MACROS, and "Autoexec" macro. Also look up Windows Task Scheduler--if you have Windows, you can launch the db to open at a certain time. On opening of the db, the Autoexec macro runs.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top