Link to home
Start Free TrialLog in
Avatar of joe_GDB
joe_GDBFlag for United States of America

asked on

Automaticaly run a report in MS Access

I would like to run a report on the 16th and the 1st of each month, and have it run automatically in access.

Right now i have the following that runs a report every night at midnight, it updates a temp table then runs a report:

Private Sub Form_Timer()
    If Time() = CDate("12:00am") Then
        Call UpdateTempTables
    End If
End Sub

I'm wondering is there a way along this same line to run a report on the 16th and 1st of every month?


Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Joe,

  Rather then doing this within Access, your better off to call Access with a command line switch (either /x, which calls a macro or /cmd, which passes command line arguments) and use the Windows task scheduler to do the scheduling.

 JimD.
SOLUTION
Avatar of Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of joe_GDB

ASKER

thanks for the quick response.  I like the Task Scheduler idea but how would i set that up to open the specific database and then "Call UpdateTempTables"
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The TimerInterval and logging success become important because on the 1st and 16th, the form is going to attempt that sub once every 'TimerInterval' milliseconds for the full 24 hrs.  You could take the TimerInterval to 300000 - five minutes - or longer.  What becomes critical is how crucial it is for the other report to run at EXACTLY midnight, because if you open the form at 4:25, say, and set the interval for an hour, things will happen at 12:25.

It all depends on how you want to tackle it. :)
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.