ACC: Compile Errors Not Reported When Form Opened with Code

ID: Q121013


The information in this article applies to:


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 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          : kberrmsg kbusage FmsEvnt 
Version           : 1.0 1.1 2.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 7, 1999