PRB: Print Setup Triggers Report's OnClose, OnOpen Properties

    Article ID: Q109944
    Creation Date: 10-JAN-1994
    Revision Date: 19-SEP-1996

    The information in this article applies to:

    • Microsoft Access versions 1.0 and 1.1

    SYMPTOMS

    When you preview a report, choosing the Setup button on the toolbar and then choosing the OK in button the Print Setup dialog box activates the report's OnClose and OnOpen properties.

    CAUSE

    When you choose OK in the Print Setup dialog box, the report is closed and then reopened with the new printer settings. When the report is closed and reopened, its OnClose and OnOpen properties are triggered.

    RESOLUTION

    Since you cannot prevent the OnClose and OnOpen properties from being triggered when you choose OK in the Print Setup dialog box, you may want to hide the toolbar so that the Setup button is not available.

    STATUS

    This problem no longer occurs in Microsoft Access version 2.0.

    MORE INFORMATION

    Steps to Reproduce Behavior

    1. Open the sample database NWIND.MDB.
    2. Create two new macros, each with a MsgBox action. Give the first macro the message box text "OnClose" (without quotation marks) and save it as OnClose Macro. Give the second macro the message box text "OnOpen" (without quotation marks) and save it as OnOpen Macro.
    3. Open the Invoice report in Design view.
    4. Set the report's OnOpen property to the OnOpen Macro macro and set the report's OnClose property to the OnClose Macro macro.
    5. Preview the report.
    6. Click the Setup button on the toolbar.
    7. In the Print Setup dialog box, choose OK. A message box with the text "OnClose" will be displayed, indicating that the report's Close event occurred. After you choose OK, a message box with the text "OnOpen" will be displayed, indicating that the report has been reopened and its OnOpen property triggered.
    8. Close the report. Do not save the changes to the report.


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.
©1997 Microsoft Corporation. All rights reserved. Legal Notices.

Additional reference words: 1.00 1.10
KBCategory: kbusage
KBSubcategory: RptProp