ACC: No "Can't Add Records" Data Mode Arg for OpenForm 95/97

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

SYMPTOMS

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

When you are setting the OpenForm macro action's Data Mode argument, you can select Add, Edit, or Read Only. However, the Data Mode argument does not have a setting that you can select that prevents adding new records to a form.

RESOLUTION

To work around this behavior, use Visual Basic code to pass a True or False value in the OpenArgs argument of the OpenForm action to set the AllowAdditions property in the form's Load event.

The following example demonstrates how you can use the OpenForm macro action's OpenArgs argument to pass the specified AllowAdditions setting for use in a form.

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

  1. Open the sample database Northwind.mdb.

  2. Open the Employees form in Design view.

  3. Type the following code for the form's Load event:

          Private Sub Form_Load (Cancel As Integer)
    
             Me.AllowAdditions = Me.OpenArgs
          End Sub
    
    

  4. Save, and then close the form.

  5. Open the Utility Functions module in Design view and on the View menu, click Debug Window.

  6. Type the following statement in the Debug window, and then press ENTER:

          DoCmd.OpenForm "Employees",,,,,,False
    

    Note that the Employees form opens. You cannot add records, but all the employee records are available.

STATUS

This behavior is by design.


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


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.