PRB: "Save Changes to Form" Prompt When No Changes Made

    Article ID: Q115876
    Creation Date: 06-JUN-1994
    Revision Date: 19-SEP-1996

    The information in this article applies to:

    • Microsoft Access version 2.0

    SYMPTOMS

    Advanced: Requires expert coding, interoperability, and multiuser skills.

    Each time you open a form in Form view and then close it, you are prompted to save the changes to the form even if you have not made any changes to the form.

    CAUSE

    The form contains an OLE Object, and the object frame's Locked property is set to No.

    RESOLUTION

    To keep from being prompted to save your changes each time you close the form, set the object frame's Enabled property to No and its Locked property to Yes. Note that if you set both the Enabled and the Locked properties to Yes, you will receive the following message when you close the form, and any changes to the form will be discarded:

       The object is locked and any changes made will be discarded
       when the form is closed.
    
    
    Workaround to Allow Editing

    The following example demonstrates how to keep from being prompted to save your changes each time you close the form, but still allow changes to be made to the form.

    CAUTION: Following the steps in this example will modify the sample database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform these steps on a copy of the NWIND database.

    1. Open the Sales By Product form in Design view.
    2. Add a new command button to the form.
    3. Click the secondary mouse button on the new command button. Choose Build Event, then select Code Builder and choose OK. Enter the following code in the module:

            Me!Embedded13.Enabled = -1
            Me!Embedded13.Locked = 0
            DoCmd GoToControl "Embedded13"
      
    4. Close the module.
    5. Set the graph object's Enabled property to No and its Locked property to Yes.
    6. Set the graph object's OnExit property to the following event procedure:

            DoCmd GoToControl "Product Name"
            Me!Embedded13.Enabled = 0
            Me!Embedded13.Locked = -1
            SendKeys "%FS"
      

      To create this event procedure, click in the OnExit property field, then choose the Build button at the right side of the field. Select Code Builder, and then choose OK. Enter the code in the module, and then close the module.

    7. Save and then close the form.

    When you open the form, the graph will not be enabled. If you close the form, you will not be prompted to save your changes. However, if you choose the new command button, the graph will be enabled. When you select a different control on the form, the graph will be locked and the form will be saved.

    Note that if you choose the command button and then immediately close the form, you will be prompted to save your changes. This is due to the timing of the OnExit property.

    STATUS

    This behavior no longer occurs in Microsoft Access for Windows 95 version 7.0.

    MORE INFORMATION

    Steps to Reproduce Behavior

    1. Open the sample database NWIND.MDB.
    2. Open the Sales By Product form.
    3. Close the form without making any changes. Note that you are prompted to save your changes even though you did not make any.


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: 2.00
KBCategory: kbusage
KBSubcategory: FmsOthr