'Disconnect a recordset...
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
'using a regular old Jet backend.
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=X:\MyBE\BackendDB.Mdb"
'Connect to source.
cn.Open
'Open recordset, bringing all recs across net to client.
With rst
.CursorLocation = adUseClient 'A potentially heavy dose of net traffic.
.Source = "TblData" 'better to use a SQL statement that restricts recs.
.CursorType = adOpenStatic 'required for client-side cursor.
.ActiveConnection = cn
.LockType = adLockOptimistic
.Open
End With
'Disconnect recordset from its source and close connection.
Set rst.ActiveConnection = Nothing
cn.Close
'Test to see if data is still around on client...
Debug.Print rst.Fields(0)
Debug.Print rst.Fields(1)
'Someplace, somewhere, you will eventually want to
'remove the reference to your rst by setting it to nothing...
Set rst = nothing
'... but not before you have done what you want with the data,
'changing recs and then reconnecting to update your data source
'one rec at a time or in a batch, etc.
'Will this now raise an errror?
Debug.Print rst.Fields(0)
Debug.Print rst.Fields(1)