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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run MS Access Macro using Task Scheduler

Status
Not open for further replies.

mischief911

Technical User
Jan 14, 2002
21
US
Does anyone have any documentation about using Windows Task Scheduler to launch a MS Access macro? What is the syntax / or pathing needed to accomplish this. I cannot find ANY documentation on this matter.

I have done this before and I seem to remember the path was somthing like

"[directory path to MS Access exe file]" "[directory path to MS Acces *.mdb file]" ....(don't remember the rest...)

I appreciate your help with this!
 
You're just about there, add /x MacroName to execute the macro of your choosing.

Additional command line info can be added using /cmd; the Command function (or is it a variable) can be used to retrieve the information following /cmd.

Naturally, /cmd is the last parsable item on the command line.
 
Alternative (if possible): rename your macro to AutoExec and you don't need the /x switch.

However, this restricts you to one macro. /x MacroName is more flexible...

Good luck

[pipe]
Daniel Vlas
Systems Consultant
 
For whatever reason I am still not able to get this to work. I am using Windows 2000 and I am logged on as as user with Administrator rights.

Using task scheduler I am trying to launch a macro called "mcrTestMacro" located in MS Access mdb file "C:Test\Test.mdb". I am able to run the macro from within the mdb file (it simply emails a table to a yahoo email account in *.txt format).

However, I have tried several ways to set up task scheduler

1st using "D:\Program Files\Microsoft Office\Office\MSAccess.exe" in the "Start In" text box (note path is in quotes) and then placing "C:\Test\Test.mdb /x mcrTestMacro" in the "Run" text box within the first tab of the Task Scheduler (this path also in quotes)

It doesnt work. Then I tried putting the "[path to MSAccess.exe}" space "[path to Test.mdb file]" /x mcrTestMacro - NUTTIN WORKS.

I am probably missing something really simple. Help!
 
I don't have access (no pun intended) to a task scheduler.

An alternative course of action:

1) Create and debug a .bat file
2) run that from the scheduler.
 
Your StartIn textbox is correct but your syntax for the Run box is not correct. Try this:
"D:\Program Files\Microsoft Office\Office\MSAccess.exe" "C:\Test\Test.mdb" /xmcrTestMacro

That should do it.

Paul
 
P.S You need the path to the Access.exe file in the Run box as well as the path to the .mdb file so that line should all go in the Run Box.

Paul
 
...with one space between access.exe path and file path.
And with one space between /x and mcrTestMacro

If you have only one version of Access on your computer, the short version (no path to msacces.exe) will also work:

"msaccess.exe " "C:\Test\Test.mdb /x mcrTestMacro"

Good luck,

[pipe]
Daniel Vlas
Systems Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top