Microsoft KB Archive/230575

From BetaArchive Wiki
Knowledge Base


Article ID: 230575

Article Last Modified on 1/24/2007



APPLIES TO

  • Microsoft Access 2000 Standard Edition
  • Microsoft Windows XP Professional
  • Microsoft Windows NT 4.0
  • Microsoft Windows 2000 Standard Edition



This article was previously published under Q230575

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:

  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:

       Macro Name Condition  Action
       ------------------------------
       Macro1                OpenForm
       
    
       Test1 Action Arguments
       ----------------------
       OpenForm
       Form Name: Customers
       View: Form
       Window Mode: Normal
                        
  4. Save the macro and close the database.
  5. On the Start menu, point to Settings, and then click Control Panel.
  6. In Control Panel, open Services.
  7. 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.
  8. In the list, double-click the Schedule service. This displays the Schedule dialog box.
  9. In the Schedule dialog box, select Log on as This account, and click the Build (...) button.
  10. 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.

  11. Save the file to the root of your drive C as "MyTest.bat" (including the quotation marks).
  12. 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: kbhowto KB230575