Microsoft KB Archive/231478

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

Article ID: 231478

Article Last Modified on 1/24/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q231478



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



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.</li> 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 Task Scheduler" section, and proceed with those steps instead.</li> In the list, double-click the Schedule service. This displays the Schedule dialog box.</li> In the Schedule dialog box, select Log on as This account and click the Build (...) button.</li>  Using Notepad, or any text editor, type the following lines: <pre class="fixed_text">  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. </li> Save the file to the root of your drive C as "MyTest.bat" (including the quotation marks).</li> 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.</li> When the time expires, Access should open, displaying the Customers form.</li></ol>

Using Task Scheduler
If you see Task Scheduler listed in the Services dialog box, you have probably installed 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: <ol>  Using Notepad, or any text editor, type the following lines: <pre class="fixed_text">  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. </li> Save the file to the root of your drive C as "MyTest.bat" (including the quotation marks).</li> In the \Winnt\Tasks folder in Windows NT explorer, double-click Add Scheduled Task.

This starts the Scheduled Task Wizard. Click Next.</li> Click Browse.</li> In the Select Program to Schedule dialog box, go to C:\.</li> Select MyTest.bat and click Open.</li> Change the name of the task to MyTask.</li> Click One time only and click Next.</li> <li>Change the Start Time to about 2 minutes ahead of the current time, and leave the Start Date at the current date.</li> <li>Click Next. You next 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.</li> <li>Click Finish.</li> <li>When the time expires, Access should open, displaying the Customers form.</li></ol>

Additional query words: inf

Keywords: kbhowto KB231478

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.