Failsafe ways to open Access and run a macro and close

CedarTree

Registered User.
Local time
Yesterday, 21:44
Joined
Mar 2, 2018
Messages
423
Hi... looking for best ways to use Windows task scheduler to open up Access (not hidden!), run a macro, and auto close. Say once a day. Use a batch file maybe? Sample code please? Thanks!!!
 
Look into VBScript that opens access (set obj = createobject("access.application"), then set db=obj.opencurrentdatabase("path"), then access vba from there.

No ideas about macros, wouldn't use one. use vba instead.
 
or just use the windows task to open a database that's set to run something when it opens (startup form, form_load event code, code includes application.quit).
 
I think he means in the action of the Task you can paste in a shortcut path with a switch directly
 
Hi... looking for best ways to use Windows task scheduler to open up Access (not hidden!), run a macro, and auto close. Say once a day. Use a batch file maybe? Sample code please? Thanks!!!
What Tom suggested...

Look at the options for Task Scheduler tasks.

Put MSAccess.exe in the Program to Run Setting.
Add the appropriate command line setting to open a specific accdb and run a specific macro when that accdb opens. For details, you can search online for command line options for Access.

1737664061833.png
 

Users who are viewing this thread

Back
Top Bottom