Automating MS-Access 97 Reports
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????
Software
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????
by sgt_shultz
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.
Sort by Trending