ACC2000: Can't Set Form Recordset to Disconnected RecordsetID: Q230737
|
When you try to assign an ActiveX Data Objects (ADO) Recordset object to a form, you may receive the following error message:
The object you entered is not a valid Recordset property.
You assigned a disconnected ADO Recordset object to the Recordset property of the form.
Set the ActiveConnection property of the ADO recordset to a valid ADO Connection object before assigning it to the form.
ADO allows you to create a recordset, and then to disconnect it from its source. In a client/server environment, this allows you to update the recordset on the client without maintaining a constant connection to the server. Later, your changes are batch updated to the server. Even though ADO allows you to disconnect a recordset from its source and manipulate it on the client without a connection, Microsoft Access forms bound to Recordset objects require a valid ADO Connection object.
Private Sub Form_Open(Cancel As Integer)
Dim rs As ADODB.Recordset
'Create a new ADO recordset, and disconnect it
Set rs = New ADODB.Recordset
With rs
.ActiveConnection = CurrentProject.Connection
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "SELECT * FROM Customers"
.Open
.ActiveConnection = Nothing
End With
Set Me.Recordset = rs
End Sub
The object you entered is not a valid Recordset property.
For additional information about using disconnected recordsets with ADO, please see the following articles in the Microsoft Knowledge Base:
Q190717 Disconnected Recordsets with ADO or RDS
Q184397 Getting ADO Disconnected Recordsets in VBA/C++/JavaFor more information about using the form Recordset property, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type "Form Recordset Property" in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
Additional query words: prb
Keywords : kberrmsg kbdta AccessCS
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: July 6, 1999