ACC: Preventing Users from Adding New Records (95/97)

Last reviewed: July 15, 1997
Article ID: Q142185
The information in this article applies to:
  • Microsoft Access versions 7.0, 97

SUMMARY

Microsoft Access 7.0 and 97 have several new properties that give developers control over forms used for data entry. One of these properties is the AllowAdditions property. Developers can use this property to determine whether users can or cannot add new records to the underlying table.

MORE INFORMATION

You can set the AllowAdditions property under the Data tab of the form's property sheet. The default setting is Yes (True or -1) and allows the user to add new records. If you set this property to No (False or 0), the user cannot add new records. The No setting disables the New Record indicator on the toolbar and the Data Entry command on the Records menu.

The following example demonstrates how the AllowAdditions property works.

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 Customers form in Form Design view.

  3. If the property sheet is not displayed, on the View menu, click Properties to display the form's property sheet.

  4. In the Form property sheet, click the Data tab and set the AllowAdditions property to No.

  5. Add a command button to the Customers form. Set the command button's OnClick property to [Event Procedure], and then click the Build button to the right of the OnClick property box.

  6. Type the following statement in the Form_Customers module:

          Forms!Customers.AllowAdditions = True
    

  7. Close the Form_Customers module and save the Customers form.

  8. Open the Customers form in Form view. Note that Record on the Insert menu and the New Record selector are disabled. You cannot add any records. However, if you click the command button, note that the new record options are enabled.

REFERENCES

For more information about other new properties in Microsoft Access, type "new properties" in the Office Assistant, click Search, and then click to view "What's New for Developers: Overview."

For more information about preventing new records from being added in Microsoft Access 1.x and 2.0, please see the following articles here in the Microsoft Knowledge Base:

   ARTICLE-ID: Q112725
   TITLE     : ACC2: Preventing Users from Adding New Records

   ARTICLE-ID: Q100465
   TITLE     : ACC1x: Preventing Users from Adding New Records


Additional query words: grayed greyed
Keywords : FmsProp kbusage
Version : 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbinfo


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: July 15, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.