ODE97: Avoiding Common Mistakes with Distributable Run-time Apps

Last reviewed: February 4, 1998
Article ID: Q180284
The information in this article applies to:
  • Microsoft Office 97 Developer Edition Tools

SUMMARY

The process of creating a distributed run-time application is explained step-by-step in the "Developing a Run-Time Application" Help topic (click the Contents tab in Microsoft Office 97 Developer Edition Tools Help, and then click to expand the "Microsoft Office 97, Developer Edition Tools" 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 Application

When you create and distribute the run-time application, consider the following questions:

  • How was the application created?
  • Was the application tested and debugged?
  • Were Help files and topic files created?
  • Was the application tested in the run-time environment?
  • Were disk images created by using the Setup Wizard?
  • Was the application packaged and distributed?

The following sections contain more information about these questions.

How Was the Application Created?

Before you can consider the application finished, answer the following questions:

  • Did you develop a plan?
  • Did you build the application around forms?
  • Did you include error handling?
  • Did you create custom menu bars and toolbars?
  • Did you add startup options?
  • If security is required, did you properly secure the application?

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:

  • Was the application secured? If so, how?
  • Was the database split? If so, how?
  • Will the application be run from a network? If so, how?
  • What is the best way to update the application after it is distributed?

For more information about the things to consider when you create a custom application, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q162584
   TITLE     : ADT/ODE: Developing a Plan to Deploy Run-Time Applications

   ARTICLE-ID: Q162522
   TITLE     : ADT/ODE: Distributing a Split Database Application with
               ODE/ADT

   ARTICLE-ID: Q169813
   TITLE     : OFF97: Not All Files Can Be Distributed Using Setup Wizard

   ARTICLE-ID: Q163535
   TITLE     : ODE97: List of Files You Can Redistribute with ODE Run-Time
               App

   ARTICLE-ID: Q179318
   TITLE     : ACC97: How to Simulate Office Features in an ODE Application

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 the underlying queries or tables. By building your application around forms, you can control the following:

  • The commands that are available to users
  • The flow of the application
  • The appearance and behavior of the application
  • The way that users access data
  • The way that data is displayed

For more information about using forms in the application, click the Contents tab in Microsoft Office 97 Developer Edition Tools Help, click to expand the "Microsoft Office 97, Developer Edition Tools" topic, click to expand the "Developing a Run-Time Application" topic, and then click to view the "The Importance of Using Forms in Your Run-Time Application" topic.

For more information about form features that you cannot include in your custom application, please see the following article in the Microsoft Knowledge Base:

  ARTICLE-ID: Q172090
  TITLE     : ODE97: Filter-By-Form 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, "Handling Run-Time Errors," in "Building Applications with Microsoft Access 97."

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 the datasheet view of Tables and Queries, the form view, and 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:

   ARTICLE-ID: Q159692
   TITLE     : ACC97: How to Create Command Bars Using Visual Basic Code

Did you add startup options?

You can set the following startup options for the custom application:

  • Application title
  • Application icon
  • Name of Custom menu bar
  • Name of startup form

If security is required, did you properly secure the application?

When you distribute the run-time application to users who have Microsoft Access 97 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, follow these recommendations:

  • Specify the /runtime option on all command lines that you use to start the application.
  • Use the Security Wizard that is provided with Microsoft Access to secure all the objects in the database.
  • Use customized menus and toolbars in the application.
  • Set the AllowBypassKey property to False to disable the SHIFT key.
  • Set any database startup properties that could potentially give users access to the Database window or any Design view.
  • If the database contains Visual Basic code, distribute it as an MDE file.

For more information about securing the application, please see "Building Applications with Microsoft Access 97", in Chapter 14, "Securing and Delivering Your Application."

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.

For more information about implementing error handling and handling run- time errors in the application, see Chapter 8, "Handling Run-Time Errors," in "Building Applications with Microsoft Access 97."

For more information about "Routing Execution When an Error Occurs," "The On Error Statement," "The On Error Resume Next statement," and "The Resume Statement," search the Help Contents for "The Importance of Error Handling in Your Run-Time Application," and then view the topic "Elements of Run-Time Error Handling."

Were Help Files and Topic Files Created?

Your application should use its own Help file rather than the full Microsoft Access Help file (Acmain80.hlp). If you want to provide Help for your run-time application, you must create your own Help file, and then set the AppHelpFile key in the Windows Registry. You can also provide topic IDs for your help file so that you can create context-sensitive help for your topics. Microsoft Office 97 Developer Edition includes a Help Workshop to assist you in creating custom Help files, and the Setup Wizard to assist you in setting the AppHelpFile registry key when you create your Setup files.

For more information about creating your own Help files, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID:  Q171958
   TITLE     :  ODE97: Tips for Creating and Compiling Your Windows Help
                File

   ARTICLE-ID:  Q175491
   TITLE     :  ODE97: Step-by-Step Example of Creating/Compiling a Help
                File

   ARTICLE-ID:  Q163939
   TITLE     :  ODE97: Help Workshop Help Topics Contents

   ARTICLE-ID:  Q177107
   TITLE     :  ACC97: Displaying Context-Sensitive Help for 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:

  1. Run your setup program on a clean computer. This should be a computer that does not have any of the components that you are including with your custom application.

  2. Back up your Windows and Windows/System folders.

  3. Test your application.

  4. Delete the application.

  5. Delete everything in the Windows and Windows/System folders.

  6. Restore Windows and Windows/System folders from the backup.

For more information about testing your application, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q162584
   TITLE     : ADT/ODE: Developing a Plan to Deploy Run-Time Applications

For more information about errors that you may encounter when testing your application, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119754
   TITLE     : ADT/ODE: Compile Error When Running ADT or ODE Application

Were Disk Images Created by Using the Setup Wizard?

When your custom application is complete and ready to distribute to users, you need a way for users to install it. Microsoft Office 97, Developer Edition provides the Setup Wizard, which helps you create a custom Setup program for your application.

When you run the Setup 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 Setup Wizard compresses your application files and groups them so you can copy them to floppy disks or to a network drive. If your users do not already have Microsoft Access installed on their computers, the Setup Wizard can create an installation that includes the run-time version of Microsoft Access.

The Setup 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.

For more information about Network permissions, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q136140
   TITLE     : ACC: Privileges Needed for Workdir Folder

For more information about using the Setup wizard, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID:  Q162884
   TITLE     :  ODE97: Troubleshooting ODE Setup Wizard Problems

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 floppy disk or in your network installation folder.

For more information about installing your custom application, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID:  Q170695
   TITLE     :  ODE97: How to Resolve Path/File Access Error in Setup
                Wizard

   ARTICLE-ID:  Q177590
   TITLE     :  ODE97: Setup Not Completed Successfully Installing Custom
                App

   ARTICLE-ID:  Q176018
   TITLE     :  ODE97: ODE Setup Wizard Error "Setup Error 825"

   ARTICLE-ID:  Q161403
   TITLE     :  ADT/ODE: Err Running Setup If More Than 40 Registry Keys
                Define

   ARTICLE-ID:  Q135382
   TITLE     :  ADT/ODE: File Compression Ratio Less Than Other Programs

   ARTICLE-ID:  Q121959
   TITLE     :  ADT/ODE: ADT/ODE Application Setup Always Defaults to
                Drive C

   ARTICLE-ID:  Q165630
   TITLE     :  ODE97: Files Added to the Disk Images by the ODE Setup
                Wizard

NOTE: If you want to modify your custom Setup program after running the Setup Wizard, or if you need to update files included in your application, run the Setup Wizard again. On the first page, choose the option to use previously saved setup options, and then specify the template file you saved in a previous Setup Wizard session.


Additional query words: inf
Keywords : OdeGen
Version : WINDOWS:97
Platform : WINDOWS
Hardware : x86
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 4, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.