Scheduling a Acess Macro

  • Thread starter Thread starter mdhingra01
  • Start date Start date
M

mdhingra01

Guest
Is there a way to schedule a MS Access Macro. I know I can use windows scheduler to launch MS Access on a set schedule, but how do I pinpoint to the macro I want to execute to run on that schedule. Do I need to launch MS Access, then create a macro that launches on startup that calls the other macro I am looking to schedule?

Thanks
 
'autoexec'

Check the help file for 'autoexec'... should explain how to do it...

HTH :cool:
 
This still doesn't allow a macro to be scheduled outside of Ms Access. This only allows you to launch a Macro on the Startup of MS Access. I want to be able to call the macro from Task Scheduler in Windows 2000.

Thanks
 
Can't do it directly...

but I thought you said you intended to start the db with the Task Scheduler...

If you do that then the autoexec macro will, in effect, run with the task runs... no? :confused:
 
Courtesy of MSDN:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;230575

ACC2000: How to Start Access by Using the Windows NT Schedule Service

Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SUMMARY

To start Microsoft Access by using the Microsoft Windows NT scheduling service, you must do the following:

Create a batch file with the command line options that you want to run.

On the Scheduler Service, instead of using a system account, log on as a user account that has Administrator rights.
Note Using the system account does not work correctly. The Office Assistant pops up and Access stops responding (hangs). Also, the system account does not have a default printer so, in that case, you could not print reports in Access.

MORE INFORMATION

The following steps create an example script that runs an Access database:
On a Windows NT Server machine, make a copy of the sample database Northwind.mdb, and move it to the root directory of drive C.

Open that copy of the Northwind database.

Create the following new macro called Macro1: Macro Name Condition Action

------------------------------
Macro1 OpenForm

Test1 Action Arguments
----------------------
OpenForm
Form Name: Customers
View: Form
Window Mode: Normal

Save the macro and close the database.

On the Start menu, point to Settings, and then click Control Panel.

In Control Panel, open Services.

In the Services list, look for the service called Schedule. If you see it, skip to step 9.

However, if you do not see Schedule listed in the Services list, but you do see Task Scheduler in the list, close the Services dialog box, skip to the "Using the Task Scheduler" section, and proceed with those steps instead.

In the list, double-click the Schedule service. This displays the Schedule dialog box.

In the Schedule dialog box, select Log on as This account, and click the Build (...) button.

Using Notepad, or any text editor, type the following lines:
C:
CD\Program Files\Microsoft Office\Office
Msaccess.exe C:\Northwind.mdb /x Macro1

where C:\Program Files\Microsoft Office\Office is the path to the Access executable program. Msaccess.exe may be in a different location on your computer. If so, you can use the Find command on the Start menu to locate it and determine the correct path.

Save the file to the root of your drive C as "MyTest.bat" (including the quotation marks).

To schedule the application to run, type the following at an MS-DOS prompt:

AT 4:30pm /interactive "C:\MyTest.bat"

NOTE: 4:30pm is an example. Use a time about 2 minutes ahead of the current time for this test.

When the time expires, Access should open, displaying the Customers form.

Using Task Scheduler

If you see Task Scheduler listed in the Services dialog box, you have probably installed Microsoft Internet Explorer 4.0 or later. Internet Explorer setup replaces the Schedule service with Task Scheduler. In this case, you cannot change the logon for the service. You must do so on a task-by-task basis. After completing steps 1 through 7 above, proceed with the following steps to demonstrate the example by using Task Scheduler:
Using Notepad, or any text editor, type the following lines:

C:
CD\Program Files\Microsoft Office\Office
Msaccess.exe C:\Northwind.mdb /x Macro1
where C:\Program Files\Microsoft Office\Office is the path to the Access executable program. Msaccess.exe may be in a different location on your computer. If so, you can use the Find command on the Start menu to locate it and determine the correct path.

Save the file to the root of your drive C as "MyTest.bat" (including the quotation marks).

In the \Winnt\Tasks folder in Windows NT explorer, double-click Add Scheduled Task.

This starts the Scheduled Task Wizard. Click Next.

Click Browse.

In the Select Program to Schedule dialog box, go to C:\.

Select MyTest.bat and click Open.

Change the name of the task to MyTask.

Click One time only and click Next.

Change the Start Time to about 2 minutes ahead of the current time, and leave the Start Date at the current date.

Click Next. You see the screen for the user account that the task will use.
Type the current user name and password that you are currently logged in as.

Click Finish.

When the time expires, Access should open, displaying the Customers form.
 
Last edited:
neat little MS Access scheduling program

Hi everyone,
I’m a little new to MS Access and databases, but I found a pretty cool program that can schedule macros to run by clicking a few buttons in a form. Check it out: http://macros.subpacket.com

Regards,

Steven
 
In Access right click a macro, click create shortcut. Give it a findable location. Point Windows scheduler at it. Access will open and run the macro. An orderly exit is good. The best way is to open a form with a timer as the last item in the macro, and invoke exit. If you use the scheduler to force close, Access will usually error.

Chris B
 
In Access right click a macro, click create shortcut. Give it a findable location. Point Windows scheduler at it. Access will open and run the macro. An orderly exit is good. The best way is to open a form with a timer as the last item in the macro, and invoke exit. If you use the scheduler to force close, Access will usually error.

Chris B

I got this method to work pretty easily. The issue I am running into now involves the fact that our PC's run Novell - Client for Windows on top of WinXP. The scheduling works just fine as long as the computer is on and Novell hasn't locked the workstation. When this happens, Access just errors out and nothing happens. Any ideas on how to get around this?
 
No idea sorry. I guess though that the Netware program would have options regarding locking the pc which you could turn off provided your admin is OK with it.

Chris B
 

Users who are viewing this thread

Back
Top Bottom