ACC2: OpenRecordset on Recordset Causes "Invalid Operation"

Last reviewed: June 8, 1997
Article ID: Q120914
The information in this article applies to:
  • Microsoft Access version 2.0

SYMPTOMS

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

When you use the OpenRecordSet method on a Recordset created with the RecordSetClone property of a form, you may receive the following error message:

   Invalid operation

RESOLUTION

Instead of creating the Recordset using the RecordSetClone property of the form, base the Recordset on the table or query that is the form's record source. Note that if you opened the form with a filter or a Where clause, or if you later apply a filter to the form, the changes will not be reflected in the Recordset. In such a case, you might want to save the Where condition in a global variable, and then use the variable with the Filter property of the Recordset object.

STATUS

This behavior no longer occurs in Microsoft Access version 7.0.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open the sample database NWIND.MDB.

  2. Open the Customers form in Form view.

  3. Create a new module and enter the following sample function:

          Function TestRecordset ()
    

          Dim recordset1 As Recordset
          Dim recordset2 As Recordset
    

          Set recordset1 = Forms!Customers.recordsetclone
          Set recordset2 = recordset1.OpenRecordset()
    

          End Function
    

  4. From the View menu, choose Immediate Window.

  5. Type the following line in the Immediate window, and then press ENTER:

          ?TestRecordset()
    

    Note that you receive the error message mentioned in the "Symptoms" section.

REFERENCES

Microsoft Access "Building Applications," version 2.0, Chapter 11, "Working with Sets of Records," pages 241-267


Keywords : kberrmsg kbprg MdlRcd
Version : 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


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