ACC: Compile Errors Not Reported When Form Opened with Code

Last reviewed: May 14, 1997
Article ID: Q121013
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0

SYMPTOMS

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

In Microsoft Access version 1.x, compile errors in procedures triggered by the Open event are not reported if you use Access Basic code to open a form in Dialog window mode.

In Microsoft Access version 2.0, compile errors in procedures triggered by the Load event are not reported if you use Access Basic code to open a form in any window mode.

RESOLUTION

Compile all your Access Basic code before you open the form.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Access versions 1.0, 1.1, and 2.0. This problem no longer occurs in Microsoft Access version 7.0.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start Microsoft Access and open any database.

  2. Create a new module.

  3. From the Edit menu, choose New Procedure.

  4. In the New Procedure dialog box, select the Function option button, and then type "Force_Error" (without the quotations marks) in the Name box. Choose OK.

  5. Enter the following code in the module:

    Function Force_Error()

              MsgBox 1
           End Function
    
    

  6. Save the module as Test and then close it.

  7. Create a blank new form. In Microsoft Access version 1.x, set the form's OnOpen property to:

    =Force_Error()

    In Microsoft Access version 2.0, set the form's OnLoad property to:

    =Force_Error()

  8. Save the form as MyForm and then close it.

  9. Open the MyForm form in Form view. You will receive a compile error message.

  10. Open the Test module, and then choose Immediate Window from the View menu.

  11. Type the following line in the Immediate window and then press ENTER:

    DoCmd OpenForm "MyForm",,,,,A_DIALOG

    Note that you do not receive any error message.


Keywords : FmsEvnt kberrmsg kbusage
Version : 1.0 1.1 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbbug
Resolution Type : kbworkaround


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