ACC: Form Is Inaccessible When Debugging Run-Time Error

Last reviewed: August 29, 1997
Article ID: Q100133
The information in this article applies to:

- Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SYMPTOMS

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

If a form calls an Visual Basic for Applications function that is halted because of a run-time error, the form will become inaccessible.

CAUSE

When a program halts because of a run-time error, the form's handle is not released by the system. Even though the program is no longer running, the handle is still in use.

RESOLUTION

To release the form handle after the program has halted, click Reset on the module's Run menu.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create and save a form with the following command button on it:

          Object: Command Button
          ----------------------
          Caption: Run Code
          OnClick: =Test()
    

    NOTE: In Microsoft Access version 1.x, the OnClick property is called the OnPush property.

  2. In a new module, create and save the following function named Test():

          Function Test()
          Dim x as Integer
    
             x = 1 / 0
          End Function
    
    

  3. Open the form that you created in step 1.

  4. Click the Run Code button. Note that the program will halt and that you receive the error message "Division By Zero."

  5. Click Debug (or click OK in versions 1.x and 2.0).

  6. Minimize the module in which the function is being displayed.

  7. Try to click the Run Code button again, or try to move the form. Note that you cannot manipulate the form or anything on it. This is because the form handle is not available.

  8. To release the form handle after the program has halted, click Reset (or Reinitialize in version 1.x) on the module's Run menu.
Keywords          : kbprg PgmErr
Version           : 1.0 1.1 2.0 7.0 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbprb
Solution Type     : Info_Provided


================================================================================


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: August 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.