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

ID: Q230575


The information in this article applies to:
  • Microsoft Access 2000

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

This article applies to a Microsoft Access database (.mdb) and 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:

  1. 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.


  2. Open that copy of the Northwind database.


  3. Create the following new macro called Macro1:


  4. 
       Macro Name Condition  Action
       ------------------------------
       Macro1                OpenForm
       
    
       Test1 Action Arguments
       ----------------------
       OpenForm
       Form Name: Customers
       View: Form
       Window Mode: Normal 
  5. Save the macro and close the database.


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


  7. In Control Panel, open Services.


  8. 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.


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


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


  11. 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.


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


  13. 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:
  1. 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.


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


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

    This starts the Scheduled Task Wizard. Click Next.


  4. Click Browse.


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


  6. Select MyTest.bat and click Open.


  7. Change the name of the task to MyTask.


  8. Click One time only and click Next.


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


  10. 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.


  11. Click Finish.


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


Additional query words: inf

Keywords : kbdta
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: May 21, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.