Script that runs a macro

  • Thread starter Thread starter Haji
  • Start date Start date
H

Haji

Hi,

I have an access database that runs on a Windows 2000
server. I want to run a script that runs a macro. The
macro will append a table. I want the script to run
every Sunday night. I know how to schedule something to
open but don't know how to write a script that would
specifically run my macro. Can anyone help?

Thanks,

Haji
 
Haji,

Create the macro in Access (in this case its called "mymacro"), then have
Scheduler run the following DOS script. Make sure to change the paths as
necessary to suit your system.

"c:\Program Files\Office\msaccess.exe" "c:\MyDb\MyDb.mdb" /x mymacro

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Haji,

The simplest way is to use the Command function. It allows you to pass
in a command line variable when launching Access and then grab the
value inside your app.

For example, launch your app from the scheduler thusly:
c:\path\to\app\MyAccessApp.mdb /cmd runmymacro

In your autoexec macro in the app, create a line with a condition that
says
Command()="runmymacro"
Have that macro run your query.

HTH,
Barry Gilbert
 
Back
Top