Dim c As New ADODB.Connection Dim r As New ADODB.Recordset On Error GoTo handler
c.ConnectionString = connectStr c.CursorLocation = adUseClient c.Open Set r.ActiveConnection = c r.Open SqlText, , adOpenKeyset, adLockBatchOptimistic, -1 Set r.ActiveConnection = Nothing ' This disconnects the recordset. c.Close Set c = Nothing ...... ...... ' Recordset is now in disconnected state; do something with it. r.Close Set r = Nothing ......