Code to run a disconected recordset (which by the way will allow the .RecordCount property to be calculated). This is useful mainly for reads of data where you don’t need to lock the recordset for any reason. Before we migrated to .Net we used this in our enterprise web applications all the time.
Public Sub GetData()
On Error GoTo err_des
Dim cn As ADODB.Connection
Dim rs As New ADODB.Recordset
Set cn = CurrentProject.AccessConnection ‘Here we’re using Microsoft Access, you could create your own connection in much the same way.
rs.CursorLocation = adUseClient
Call rs.Open(“q_GetSomeData”, cn, adOpenStatic, adLockBatchOptimistic)
Set rs.ActiveConnection = Nothing
‘do something with rs here.
MsgBox “oops: ” & Err.Description