Article ID: 247530 - View products that this article applies to.
This article was previously published under Q247530
This article has been archived. It is offered "as is" and will no longer be updated.
For a Microsoft Office 97 Developer Edition version of this article, see 180284
For a Microsoft Office XP Developer version of this article, see 304007
The process of creating a distributed run-time application is explained step-by-step in Chapter 2 of "Microsoft Office 2000/Visual Basic Programmer's Guide" Help topic (click the Contents tab in Microsoft Office 2000 Developer Edition Tools Help, and then click to expand the MSDN Library - Office 2000 Developer, Office 2000 Developer Topics topic). This article lists available resources and troubleshooting steps that you should use to avoid making common mistakes when you create a custom application.
Things to Consider When You Create and Distribute a Run-Time ApplicationWhen you create and distribute the run-time application, consider the following questions:
How Was the Application Created?Before you can consider the application finished, answer the following questions:
Did You Develop a Plan?The first step in the process is to develop a design for the application. Make sure you have answered to the following questions:
Did You Build the Application Around Forms?In general, it's a good idea to build your application around forms. Users should interact with the application through the forms that you create instead of through the underlying queries or tables. By building your application around forms, you can control the following:
For more information about form features that you cannot include in your custom application, please see the following article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/262094/EN-US/ )MOD2000: Filter-by-Form Is Not Available in Run-Time Applications
Did You Include Error Handling?It's important to include error-handling code in the application's Visual Basic for Applications procedures. When Microsoft Access encounters Visual Basic run-time errors that are not handled, it closes the application without displaying any error messages.
Microsoft Access also closes the application without displaying any error messages if it encounters any run-time errors in the application's macros. However, you cannot trap errors in macros. If you want to ensure that your application traps run-time errors, use Visual Basic procedures instead of macros.
NOTE: Avoid using the End statement in the run-time application. The End statement closes the application without producing a trappable run-time error.
For more information about implementing error handling and handling run-time errors in the application, see Chapter 8 - Error Handling And Debugging of "Microsoft Office 2000/Visual Basic Programmer's Guide" Help topic (click the Contents tab in Microsoft Office 2000 Developer Help, and then click to expand the MSDN Library - Office 2000 Developer, Office 2000 Developer Topics topic). Expand the tree of Chapter 8 in Help to find the topic Handling Errors.
Did You Create Custom Menu Bars and Toolbars?To prevent users from making changes to the application, the run-time environment removes several menus and commands from the menu bar. For example, the View, Tools, and Format menus are removed from all windows. Commands on the Edit, Insert, and Records menus are also removed from the menu bars in Datasheet view of tables and queries, in Form view, and in print preview.
You must control the menus and commands that are available to users of the application by building the application around forms that have custom menus. The run-time environment disables all built-in Microsoft Access toolbars. However, even though the run-time environment does not support built-in toolbars, you can add your own custom toolbars to the application. When you create a custom toolbar, it is stored in the current database. It is automatically available to the application.
For more information about creating custom menu bars and toolbars, please see the following article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/209974/EN-US/ )ACC2000: How to Create Command Bars by Using Visual Basic Code
Did You Add Startup Options?You can set the following startup options for the custom application:
If Security Is Required, Did You Properly Secure the Application?When you distribute the run-time application to users who have Microsoft Access 2000 on their computers, you should take several precautions to protect the database. To prevent users from making modifications to the objects and code, or from inadvertently causing problems with the application, consider these recommendations:
Was the Application Tested and Debugged?When you program an application, you must consider what happens when an error occurs. An error can occur in an application for either of two reasons. The first reason is that some condition at the time the application is run causes the otherwise valid code to fail. For example, if the code attempts to open a table that the user has deleted, an error occurs. The second reason is that the code may contain improper logic that prevents it from doing what you intended. For example, an error occurs if the code attempts to divide a value by zero.
If you have not implemented error handling, Visual Basic halts execution and displays an error message when an error occurs in the code. The user of the application is likely to be confused and frustrated when this happens. You can forestall many problems by including thorough error-handling routines in the code to handle any errors that may occur.
When you add error handling to a procedure, you should consider how the procedure routes execution when an error occurs. The first step in routing execution to an error handler is to enable an error handler by including some form of the On Error statement in the procedure. The On Error statement directs execution in event of an error. If there's no On Error statement, Visual Basic simply halts execution and displays an error message when an error occurs.
When an error occurs in a procedure that contains an enabled error handler, Visual Basic does not display the normal error message. Instead, it routes execution to an error handler if one exists. When execution passes to an enabled error handler, that error handler becomes active. Within the active error handler, you can determine the type of error that has occurred and address it in a manner of your choosing. Microsoft Access provides two objects that contain information about errors that have occurred, the Visual Basic Err object and the DAO Error object.
Were Help Files and Topic Files Created?Your application should use its own Help file rather than the full Microsoft Access Help file (Acmain90.hlp). If you want to provide Help for your run-time application, you must create your own Help file, and then set the AppHelpFile registry key. You can also provide topic IDs for your Help file so that you can create context-sensitive help for your topics. Microsoft Office 2000 Developer Edition includes a Help Workshop to assist you in creating custom Help files.
For more information about setting the AppHelpFile registry key when you create your Setup files, please see the following article in the Microsoft Knowledge Base:
243051For more information about creating your own Help files, please see the following article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/243051/EN-US/ )MOD2000: AppHelpFile Run-Time Option Does Not Work
(http://support.microsoft.com/kb/202314/EN-US/ )MOD2000: How to Display Context-Sensitive Help for the What's This Button
Was the Application Tested in the Run-Time Environment?You should always test and debug your application on a clean computer. This will ensure that when you package your application you are including all the files that you need to successfully run your application. To test your application on a clean computer, follow these steps:
Were Disk Images Created by Using the Package and Deployment Wizard?When your custom application is complete and ready to distribute to users, you need a way for users to install it. Microsoft Office 2000 Developer Edition provides the Package And Deploy Wizard, which helps you create a custom Setup program for your application.
When you run the Package And Deploy Wizard, you answer questions about the files that you want to copy to users' hard disks, the Microsoft Access features that your application requires, and how the Setup program should customize the installation of your application. Then the Package and Deployment Wizard compresses your application files and groups them so you can copy them to a CD or to a network drive. If your users do not already have Microsoft Access installed on their computers, the Package And Deploy Wizard can create an installation that includes the run-time version of Microsoft Access.
The Package And Deploy Wizard compresses and groups files based on your choices and creates a custom template that the Setup program will use to install your application.
NOTE: If you choose Network Installation when you create your disk images, remember that the user must connect to the folder or directory in which the files are stored to run the Setup.exe file. This means that the folder must be shared. In a Windows NT or a Netware environment, the user must also have the necessary permissions to run the Setup program and copy files.
Was the Application Packaged and Distributed?After your Setup program is complete, you're ready to distribute your application. To install your application, users can simply run the Setup program file included on your CD or in your network installation folder.
For more information about installing your custom application, please see the following articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/208792/EN-US/ )MOD2000: File compression Ratio Less Than Other Programs
(http://support.microsoft.com/kb/241738/EN-US/ )MOD2000: Custom Installation of Access 2000 Run-Time Component May Overwrite Access 97 Default Installation
(http://support.microsoft.com/kb/255516/EN-US/ )MOD2000: You Are Prompted to Restart and Update System Files Every Time That You Try to Run Setup on a Windows 2000-Based Computer
(http://support.microsoft.com/kb/253662/EN-US/ )MOD2000: "An Error Occurred While Registering the File Msado21.tlb" Error Message When You Install Package
(http://support.microsoft.com/kb/236534/EN-US/ )MOD2000: You Cannot Change Default "Start In" Setting for Shortcuts
240961NOTE: If you want to modify your custom Setup program after running the Package and Deployment Wizard, or if you need to update files included in your application, run the Package and Deployment Wizard again. On the first page, choose the Setup script name that you saved in a previous Package And Deploy Wizard session.
(http://support.microsoft.com/kb/240961/EN-US/ )MOD2000: Internet Explorer 5 Is Included in all Access Run-Time Installations
Contact us for more help
Connect with Answer Desk for expert help.