Microsoft KB Archive/121013

= ACC: Compile Errors Not Reported When Form Opened with Code =

Article ID: 121013

Article Last Modified on 5/6/2003

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition

-



This article was previously published under Q121013



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



SYMPTOMS
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.



Steps to Reproduce Problem
 Start Microsoft Access and open any database. Create a new module. From the Edit menu, choose New Procedure. In the New Procedure dialog box, select the Function option button, and then type Force_Error in the Name box. Choose OK.  Enter the following code in the module:

Function Force_Error MsgBox 1 End Function </li> Save the module as Test and then close it.</li>  Create a blank new form. In Microsoft Access version 1.x, set the form's OnOpen property to:

<pre class="fixed_text">      =Force_Error

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

<pre class="fixed_text">      =Force_Error

</li> Save the form as MyForm and then close it.</li> Open the MyForm form in Form view. You will receive a compile error message.</li> Open the Test module, and then choose Immediate Window from the View menu.</li> 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.</li></ol>

Keywords: kberrmsg kbbug kbusage KB121013

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.