Microsoft KB Archive/826762

From BetaArchive Wiki
Knowledge Base


Article ID: 826762

Article Last Modified on 11/6/2003



APPLIES TO

  • Microsoft Access 2002 Standard Edition
  • Microsoft Office XP Developer Edition, when used with:
    • Microsoft Windows XP Professional





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

Moderate: Requires basic macro, coding, and interoperability skills.

SYMPTOMS

When you use the Microsoft Office XP Developer Packaging Wizard to package an application, you may include and you may run a .bat file or an .exe file at the end of the package installation. By default, when you add a .bat file or an .exe file to the package, the Packaging Wizard sets the installation location to $(AppPath). However, when you deploy the package on a computer that runs the Microsoft Windows XP operating system, the .bat file or the .exe file does not run at the end of the package installation.

WORKAROUND

To work around this problem, set the Installation Location for the .bat file or for the .exe file to $(WinPath) in the Packaging Wizard.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Log on to a computer that runs the Windows XP operating system.
  2. Create a batch file by using a text editor such as Notepad.

    To do this, create a batch file that copies the shortcut for the application that is deployed on your computer from the current user profile to the All Users profile as follows. The shortcut is available to other users who log on to your computer.
    1. Click Start, and then click Run.
    2. In the Run dialog box, type notepad in the Open box.
    3. In the Notepad editor, type or paste the following code:

      MKDIR "<Installation Drive>:\Documents and Settings\All Users\Start Menu\Programs\Northwind"
      :loop
      if exist "<Installation Drive>:\Documents and Settings\administrator\Start Menu\Programs\Northwind" goto iNext
      goto END
      :iNext
      copy "<Installation Drive>:\Documents and Settings\administrator\Start Menu\Programs\Northwind\" "<Installation Drive>:\Documents and Settings\All Users\Start Menu\Programs\Northwind\"
      :END

      Note Replace Installation Drive in this code with the appropriate drive letter on you computer.

    4. Save the file as CopyShortcut.bat.

    When you deploy a distribution package on your computer, the Setup creates a shortcut for the application on the Start menu. By default, the shortcut is created in the profile of the current user. As a result, the shortcut for the application is available only to the current user.

    For example, if the current user is user1, the shortcut is created in the Installation Drive:\Documents and Settings\user1\Start Menu\Programs\ folder.

    If the batch file executes successfully at the end of the package installation, the shortcut for the application is available to any user who logs on to the computer.
  3. Create a distribution package for the Northwind database. Include the batch file in the distribution package for the Northwind database such that the CopyShortcut.bat batch file runs at the end of the package installation. To do this, follow these steps:
    1. Start Microsoft Access 2002.
    2. Open the Northwind.mdb Northwind sample database.
    3. On the Tools menu, point to Macro on the Database window, and then click Visual Basic Editor.
    4. In the Microsoft Visual Basic Editor, click Packaging Wizard on the Add-Ins menu.
    5. In the Identify Application and Package window of the Packaging Wizard dialog box, click Next.
    6. In the Application Information window, click Next.
    7. In the Dependencies window, click Add File.
    8. In the Open dialog box, locate the CopyShortcut.bat batch file that you created earlier in this article.
    9. Click CopyShortcut.bat, and then click Open.

      The CopyShortcut.bat batch file appears in the list of files in the Packaging Wizard.
    10. Click Next.

      In the Modify Installation Locations window of the Packaging Wizard dialog box, the default value for the Installation Location is set to $(AppPath).
    11. In the Access Runtime window, click Next.
    12. In the Access Runtime Properties window, click Next.
    13. In the Define Short Menu Shortcuts window, click Next.
    14. In the Run on Complete window, click to select the Run this command when installation is finished check box, and then click $(AppPath)\CopyShortcut.bat on the list.
    15. Click Finish.
    16. In the Browse for Folder dialog box, locate the folder where you want to store the distribution package, and then click OK.
    17. In the Package Complete window of the Packaging Wizard, click Close.
  4. Install the distribution package for the Northwind database. To do this, follow these steps:
    1. Start Microsoft Windows Explorer.
    2. In Windows Explorer, locate the folder where the distribution package for the Northwind database is created.
    3. Double-click the setup.exe file.
    4. Follow the steps that the wizard provides to deploy the application.
  5. Log on to your computer again by using the logon name of another local Microsoft Windows user.

If you log on to your computer by using a logon name that is different from the logon name that you used to install the package, the shortcut for the application is not available in the Start menu. This situation occurs because the batch file does not run at the end of the package installation. To verify this situation, examine the contents of the Installation Drive:\Documents and Settings\All Users\Start Menu\Programs\Northwind folder. If the CopyShortcut.bat batch file runs successfully at the end of the package deployment, this folder should contain a shortcut for the Northwind database.


Additional query words: ACC2002 WinXP Win XP ACCXP


Keywords: kbpdwizard kbpackage kbprb kbdeployment kbpackaging KB826762