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

ID: Q131585


The information in this article applies to:


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          : kbusage FmsProp 
Version           : 7.0 97
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: May 3, 1999