Microsoft KB Archive/842004

From BetaArchive Wiki

Article ID: 842004

Article Last Modified on 5/18/2007



APPLIES TO

  • Microsoft Office Access 2003 Developer Extensions





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

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

For a Microsoft Office 97 Developer Edition version of this article, see 180284.

For a Microsoft Office 2000 Developer version of this article, see 247530.

For a Microsoft Office XP Developer version of this article, see 304007.

Important This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry


SUMMARY

This article describes the issues that you must consider when you create a distributable Access run-time application by using Microsoft Office Access 2003 Developer Extensions.


INTRODUCTION

You can create a custom distributable Access run-time application by using Access 2003 Developer Extensions. You can distribute this Access run-time application. This Access run-time application can run on computers that are not running Microsoft Office Access 2003. This article describes the troubleshooting steps that you can use to avoid mistakes and the issues that you must consider when you create and you distribute this Access run-time application.

back to the top

How to create a custom distributable Access run-time application

The following sections describe the issues that you must consider when you create an Access run-time application.

back to the top

Develop a plan

To create an efficient distributable Access run-time application, you must develop a design for the Access run-time application. When you develop the design of the Access run-time application, you must consider the following issues:

  • Design to help secure the application if you have to. Also, verify the method that you use to help secure the application.
  • Design to split the database if you have to. Also, verify the method that you use to split the database.
  • Verify whether the users run the application from a network location. Also, verify the method that the users use to access the application.
  • Verify the most efficient method that you can use to update the application after you distribute the application.

back to the top

Build the distributable Access run-time application by using forms

We recommend that you build your Access run-time application by using forms. Users of your Access run-time application must interact with the application by using the forms in the Access run-time application instead of using the underlying queries or the underlying tables. When you build your application by using forms, you can control the following:

  • The commands that are available to the users in the Access run-time application
  • The flow-of-control in the Access run-time application
  • The appearance and the behavior of the Access run-time application
  • The way that users access the data in the Access run-time application
  • The way that data appears in the Access run-time application

back to the top

Include error handling

When Access 2003 encounters Microsoft Visual Basic run-time errors that are not handled in the Access run-time application, Access 2003 closes the application. Access 2003 does not display any error messages. This behavior may occur when there are run-time errors in the macros that are defined in the application.

Therefore, you must make sure that your application traps the run-time errors. To do this, you must include error handling in the Microsoft Visual Basic for Applications (VBA) code of your Access run-time application. You can use the Visual Basic procedures instead of using macros because you cannot trap the run-time errors in macros.

Note You must avoid using the End statement in your Access run-time application. The End statement closes the Access run-time application without producing a run-time error that can be trapped.

back to the top

Create custom menu bars and custom toolbars

To prevent users from making changes to the Access run-time application, the Access run-time environment removes several menus from the menu bar. For example, all the following menus are removed from all the windows of your Access run-time application:

  • The View menu
  • The Tools menu
  • The Format menu

The previous menus are also removed from the menu bars in Datasheet view for tables and for queries

To prevent users from making changes to the Access run-time application, the Access run-time environment removes the commands from the following drop-down menus:

  • The commands on the Edit menu
  • The commands on the Insert menu
  • The commands on the Records menu

The previous commands are also removed in Form view for forms and in Print Preview for reports.

You can control the menus and the commands that are available to users of the Access run-time application. To do this, build the application by using forms that have custom menus. The Access run-time environment does not provide all built-in Access 2003 toolbars and does not support all built-in Access 2003 toolbars. However, you can add your own custom toolbars to the Access run-time application. When you create a custom toolbar, the custom toolbar is stored in the current database of the Access run-time application. Therefore, the custom toolbar is automatically available to the Access run-time application.

back to the top

Add the startup options

You can set the following startup options for the custom distributable Access run-time application:

  • Application title
  • Program icon
  • Name of the custom menu bar
  • Name of the startup form

back to the top

Enhance the security of the distributable Access run-time application if you have to

When you distribute the Access run-time application to the users who have Access 2003 installed on their computers, you must take several precautions to help protect the database. To prevent the users from making modifications to the database objects or to the code, you must consider the following recommendations:

  • Specify always the /runtime command-line option when you use the command line to start the Access run-time application.

    You can enforce the /runtime command-line option by using the shortcut that is created when you deploy the Access run-time application. To do this, click to select the /runtime (Run Access in Runtime mode) check box on the Shortcut Properties page of the Package Wizard.
  • Use the User-Level Security Wizard that is provided with Access 2003 to help secure all the database objects in your Access database.
  • Use customized menus and customized toolbars in the Access run-time application.
  • Set the AllowBypassKey property to False to disable the SHIFT key when the Access run-time application is opened.
  • Set any database startup properties that can potentially give users access to the Database window or to any window in Design view.
  • If the database contains Visual Basic code, distribute the database as an .mde file.
  • Digitally sign your VBA macro projects.

    When you add a digital signature to a VBA macro project, you supply a verifiable signature that can vouch for the authenticity and the integrity of the VBA macro project.

    For additional information about trusted third-party commercial certificate authorities, visit the following Microsoft Web site:

    Microsoft Root Certificate Program Members

For additional information about how to add a digital signature to an Access 2003 run-time application, click the following article number to view the article in the Microsoft Knowledge Base:

832510 How to add a digital signature to an Access 2003 run-time application


back to the top

Test and debug the distributable Access run-time application

When you develop an Access run-time application, you must consider what occurs when an error occurs in the application. An error may occur in the application for either of the following reasons:

  • Some run-time conditions may cause valid code to fail at the time the application runs.


For example, an error occurs if the code in the application tries to open a table that the user has deleted.

  • The code in the application may contain incorrect logic that prevents the code from doing what you want.


For example, an error occurs if the code tries to divide a value by zero.


When an error occurs in the code, Visual Basic stops the program, and you may receive an error message if you do not implement error handling in your application. The user of the application may be confused when this behavior occurs. You can prevent many problems by including complete error-handling routines in the code to handle any errors that may occur in your application. When you add the error handling routines to a Visual Basic procedure, you must also consider the execution path of the procedure when an error occurs.

To implement an error handler in your Visual Basic procedure, you can use the On Error statement in the procedure. The On Error statement determines the execution path of the procedure when an error occurs. If you do not specify the On Error statement, Visual Basic stops the program, and you may receive an error message.

When an error occurs in a Visual Basic procedure that contains an enabled error handler, Visual Basic passes the control to the error handler instead of displaying the error message. In the active error handler you can determine the type of error that occurs, and then you can customize the behavior of your procedure on the occurrence of the error.

Access 2003 provides the following built-in objects that contain information about the errors that may occur when you run an Access application:

  • The Visual Basic Err object
  • The Data Access Objects (DAO) Error object
  • The Microsoft ActiveX Data Objects (ADO) Error object

back to the top

Create the Help files and the topic files

Warning If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

Your distributable Access run-time application must use the custom Help files that contain information about the Access run-time application. To provide help for your Access run-time application, you must create the required Help files and then set the AppHelpFile registry key accordingly. To create context-sensitive help for the topics that are related to your Access run-time application, you can assign a topic ID for the related Help file.

You can create the custom Help files for your application by using Microsoft HTML Help Workshop.

For additional information about how to create custom Help files, click the following article number to view the article in the Microsoft Knowledge Base:

828419 How to create an HTML Help system by using either the HTMLHelp API or the HTML Help in Access


For additional information about Microsoft HTML Help, visit the following Microsoft Web site:

Microsoft HTML Help 1.4 SDK

back to the top

Test the application in the run-time environment

You must test your Access run-time application on a clean computer to make sure that the distributable package for your Access run-time application includes all the files that you must have to run your application successfully. To test your Access run-time application on a clean computer, follow these steps:

  1. Run your Setup program to install the Access run-time application.


Note A clean computer is a computer that has a newly-installed version of Microsoft Windows. Also, a clean computer has no other applications that are running and no other components that you are including with your custom application that are running.

  1. Test your application.

back to the top

Create the setup files for the distributable Access run-time application by using the Package Wizard

After you create and you test your Access run-time application, you must create a Setup program that can install your Access run-time application on the client computers. Access 2003 Developer Extensions include the Package Wizard that helps you create a custom Setup program for your Access run-time application.

When you run the Package Wizard, you must add the details of all the files that you want to copy to the computers that run your Access run-time application. You must also specify the Access features that your Access run-time application requires. In the Package Wizard, you must specify how the Setup program must customize the installation of your Access run-time application. Based on the specifications, the Package Wizard compresses your application files and then groups your application files in folders so that you can copy the setup files to a CD or to a network drive.

If the users of your Access run-time application do not already have Access 2003 installed on their computers, the Package Wizard can create an installation that includes the run-time version of Access 2003.

back to the top

Package and distribute the distributable Access run-time application

After you create the Setup program for your Access run-time application by using Access 2003 Developer Extensions, you can distribute your Access run-time application. To install your Access run-time application, users must run the Setup program that is included on the installation CD or in your network installation folder.

Note If you have to modify your custom Setup program after you package the Access run-time application, or if you have to update the files that are included in your Access run-time application, you must run the Package Wizard again. On the first page of the Package Wizard, you must select the existing package template that you saved when you created the distributable package for your Access run-time application in the previous Package Wizard session.

back to the top

REFERENCES

For additional information about Access 2003 Developer Extensions, visit the following Microsoft Developer Network (MSDN) Web site:

For additional information about how to create a distributable Access run-time application by using Access 2003 Developer Extensions, visit the following MSDN Web sites:

Basics for building Microsoft Office Access 2003 runtime-based solutions

Deploying complex Microsoft Office Access runtime-based solutions

For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

827491 The Microsoft Office Access 2003 run-time environment is the default file association for Microsoft Access Databases (.mdb) and for Microsoft Access Projects (.adp)


828406 The shortcut that the Package Wizard creates for a password-protected database may not open the database


The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

back to the top


Additional query words: Package and Deployment Wizard pdw p&d packaging wizards

Keywords: kbhowtomaster kbpackaging kbpdwizard kbpackage kbinfo KB842004