ACC2: Setting DefaultEditing with Access Basic Causes Requery

Last reviewed: May 14, 1997
Article ID: Q128220
The information in this article applies to:
  • Microsoft Access version 2.0

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

When you use Access Basic to set a form's DefaultEditing property to Can't Add Records, or change its DefaultEditing property from Can't Add Records to Read Only or Allow Edits, the form requeries, returning to the first record in the recordset.

RESOLUTION

To work around this problem, before setting the DefaultEditing property, store the primary key value in a variable. Then, use the FindRecord macro action or the Access Basic FindFirst method in the form's recordset clone to find a record.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.

MORE INFORMATION

Steps to Reproduce Problem

  1. Open the sample database NWIND.MDB.

  2. View the Products form in Design view.

  3. Add a command button to the form.

  4. Set the command button's OnClick property to the following event procedure:

           Sub Button143_Click ()
              ' Sets DefaultEditing property to Can't Add Records.
              Me.DefaultEditing = 4
           End Sub
    
    

  5. Add a second command button to the form and then set the command button's OnClick property to the following event procedure:

           Sub Button144_Click ()
              ' Sets DefaultEditing property to Allow Edits.
              Me.DefaultEditing = 2
           End Sub
    
    

  6. View the Product form in Form view.

  7. From the Records menu, choose Go To, and then choose Last on the menu that appears.

  8. Choose the first command button to set the DefaultEditing property to Can't Add Records. Note that the form requeries, returning to the first record.

  9. From the Records menu, choose Go To. Note that the New command is not available on the record that appears. Choose Last.

  10. Choose the second command button to set the DefaultEditing property to Allow Edits. Note that the form requeries, returning to the first record.

REFERENCES

For more information about the DefaultEditing property, search for "DefaultEditing," and then "AllowEditing, DefaultEditing Properties" using the Microsoft Access Help menu.

For more information about finding a record in a form using Access Basic, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q114556
   TITLE     : ACC: How to Find a Record in a Form Using Access Basic
 

	
	


Keywords : FmsProp kbusage
Version : 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbbug
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 14, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.