Discussion Locked

Automating MS-Access 97 Reports

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello,
How do I get a MS-Access 97 report or a group of reports to run at a certain time of day, on a specific day of the month & print accordingly automatically???

Any ideas or code????

4 replies

by sgt_shultz

put together a macro that opens the report and prints it. when that is working see access 97 help for how to get a macro to run upon opening the database and configure it to run your macro upon opening the database. then you could use Task Scheduler to run it on the appropriate day of the month...hope this helps a little

by techrep

Use the Windows Task Scheduler to start Access each day with a command line parameter /x which causes it to run a macro upon startup. Name the macro "RunReports". This macro will contain one RunCode command which calls a function named "DailyReport" that you will write to control which report is to be run. Here is the whole command line:

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "c:\yourdatabase.mdb" /x runreports

Now create a function named "DailyReport" that uses a Select Case statement to control which report is to be run. Here is an example:

Function DailyReport()
Dim TheDay as Integer

TheDay = Day(Date) 'get the day number as an integer
Select Case TheDay
Case 1
Docmd.OpenReport "Day_One", A_NORMAL
Case 2
Docmd.OpenReport "Day_Two", A_NORMAL
'.....etc, etc, etc.
End Select
End Function

This discussion is closed to new replies.