Microsoft KB Archive/120914

= ACC2: OpenRecordset on Recordset Causes "Invalid Operation" =

Article ID: 120914

Article Last Modified on 7/5/2002

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition

-



This article was previously published under Q120914



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



SYMPTOMS
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.



Steps to Reproduce Behavior
 Open the sample database NWIND.MDB. Open the Customers form in Form view.  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  From the View menu, choose Immediate Window. 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.</li></ol>

<div class="references_section">