ACC: Cannot Process Close Action in Report's OnOpen Property

ID: Q94926


The information in this article applies to:


SYMPTOMS

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

When you attempt to process a Close action in a macro that is assigned to a report's OnOpen property, you may receive the following error message.

In Microsoft Access for Windows 95 version 7.0:

A macro specified as the OnOpen, OnClose, OnFormat, OnRetreat, OnPage, or OnPrint property setting contains an invalid action for the property.

In Microsoft Access version 2.0:
Can't run this action while processing a form or report event

In Microsoft Access version 1.1:
Can't run this action while processing a report event

In Microsoft Access version 1.0:
This action can't be run while processing a form or report event.


RESOLUTION

Do not use a Close action in a macro that is assigned to a report's OnOpen property.


STATUS

This behavior is by design.


MORE INFORMATION

Steps to Reproduce Behavior


  1. Create the following new macro called CloseForm:
    
          Macro Name   Action
          -------------------
          CloseForm    Beep
                       Close
    
          CloseForm Actions
          ---------------------
          Close
             Object Type: Form
             Object Name: Form1
             Save:        No     (In Microsoft Access 7.0 only) 


  2. Create the following new macro called CloseReport:
    
          Macro Name    Action
          --------------------
          CloseReport   Beep
                        Close
    
          CloseReport Actions
          -----------------------
          Close
             Object Type: Report
             Object Name: Report1
             Save:        No     (In Microsoft Access 7.0 only) 


  3. Create a new form. Assign the CloseForm macro to the form's OnOpen property. Save the form as Form1.


  4. View the form in Form view.


  5. Create a new report. Assign the CloseReport macro to the report's OnOpen property. Save the report as Report1.


  6. Preview the report. Note that the computer beeps and you receive one of the error messages mentioned in the "Symptoms" section. Note that you did not receive an error message in step 4 when you opened the form.



Keywords          : kbusage RptProp 
Version           : 1.0 1.1 2.0 7.0
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: March 13, 1999