Microsoft KB Archive/131585

= ACC: No "Can't Add Records" Data Mode Argument for OpenForm (95/97) =

Article ID: 131585

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q131585



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.

 Open the sample database Northwind.mdb. Open the Employees form in Design view.  Type the following code for the form's Load event:

Private Sub Form_Load (Cancel As Integer) Me.AllowAdditions = Me.OpenArgs End Sub  Save, and then close the form. Open the Utility Functions module in Design view and on the View menu, click Debug Window. 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.</ol>

<div class="status_section">

STATUS
This behavior is by design.

Keywords: kbprb kbusage KB131585

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.