ACC: Cannot Open Form to Disallow Adding New Records

Last reviewed: May 30, 1997
Article ID: Q147154
The information in this article applies to:
  • Microsoft Access versions 7.0, 97

SYMPTOMS

Novice: Requires knowledge of the user interface on single-user computers.

When you open a form that has the AllowAdditions property set to No, the form opens, allowing you to add records.

CAUSE

The form is being opened programmatically using the OpenForm action with the Data Mode argument in the macro set to "Edit." If you're using Visual Basic, the Data Mode argument is set to A_EDIT or acEdit.

RESOLUTION

Omit the Data Mode argument setting so that Microsoft Access uses the property settings defined by the form.

MORE INFORMATION

When the Data Mode argument of the OpenForm action is set, Microsoft Access overrides a number of form property settings. If the Data Mode argument of the OpenForm action is set to "Edit," Microsoft Access opens the form using the following property settings:

   Allow Edits: Yes
   Allow Deletions: Yes
   Allow Additions: Yes
   Data Entry: No

Microsoft Access uses the default form property settings if you omit the Data Mode setting in the OpenForm macro action.

This behavior is likely to occur when you have a macro that opens a form, because the Data Mode argument is set to "Edit" by default. Further, this behavior can also occur when converting from Microsoft Access version 2.0.

In Microsoft Access version 2.0, you can open a form with the Data Mode argument set to Edit and disallow the addition of new records. This is possible by setting the singular DefaultEditing property to Can't Add Records. This behavior is incorrect. Microsoft Access 2.0 does not correctly override the DefaultEditing property with Allow Edits when the form is opened with the Data Mode argument set to Edit.

Steps to Reproduce Behavior

  1. Open the sample database Northwind.mdb.

  2. Open the Customers form in Design view and set the AllowAdditions property to No. Save, and then close the form.

  3. Create a new macro with the following action:

          Macro Action
          -----------------------
          OpenForm
    
             Form Name: Customers
             View: Form
             Filter Name:
             Where Condition:
             Data Mode: Edit
             Window Mode: Normal
    
          NOTE: The Data Mode argument is Edit by default.
    
    

  4. Save the macro with a unique name, and then run the macro by clicking Start on the Run menu. Note that the Customers form opens but allows you to add new records.

  5. Close the Customers form and delete Edit from the Data Mode argument of the OpenForm action. Save and rerun the macro by clicking Start on the Run menu. Note that the Customer form opens but does not allow you to add new records.

REFERENCES

For more information about OpenForm, search the Help Index for "OpenForm," or ask the Microsoft Access 97 Office Assistant.


Keywords : FmsProp kbusage
Version : 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


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.

Last reviewed: May 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.