Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

PRB: Error Assigning Non-Opened Recordset to ADODC


View products that this article applies to.

This article was previously published under Q190410

↑ Back to the top


Symptoms

When you attempt to set an ActiveX Data Objects (ADO) Data Control's Recordset object to a previously dimensioned ADO Recordset the following error is returned:
Run-time error '3704':

The operation requested by the application is not allowed if the object is closed.

↑ Back to the top


Cause

This error occurs when the recordset has not been opened yet.

↑ Back to the top


Resolution

The user may either open the recordset prior to assigning it to the ADO Data Control (ADODC), or use the ADODC to create the recordset.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Open a Standard EXE Project in Visual Basic.
  2. From the Project\Component menu, select Microsoft ADO Data Control 6.0 (OLEDB).
  3. Place an ADODC on Form1.
  4. Add the following code to the form:
       Private Sub Form_Load()
    
       Dim rs As New ADODB.Recordset
       ' Uncomment the below line to avoid error.
       ' rs.Open "Select * from authors", "DSN=Pubs", adOpenKeyset
    
       Set Adodc1.Recordset = rs
    
       End Sub
    					
RESULTS: The error occurs.

↑ Back to the top


Keywords: KB190410, kbprb, kbdatabinding, kbdatabase, kbctrl

↑ Back to the top

Article Info
Article ID : 190410
Revision : 4
Created on : 3/2/2005
Published on : 3/2/2005
Exists online : False
Views : 561