If you wanted to use an ADODB recordset which can be hand here is a function
that I use. You will have to strip out the errorhandler... It returns a
connected or disconnected recordset depending on the value of the final
argument. You can take the queries you have in Access and switch them to SQL
view to get the Select statement whicu becomes the parameters of the
function... If you leave the connection open then you can modify the data in
the Access database.
Public Function RunQuery(ByVal strSelect As String, ByVal strFrom As String, _
ByVal strWhere As String, ByVal strOrderBy, ByVal blnConnected As Boolean)
As ADODB.Recordset
Dim strConnection As String
On Error GoTo ErrorHandler
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" &
m_cDBLocation & ";"
Set RunQuery = New ADODB.Recordset
With RunQuery
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockBatchOptimistic
End With
RunQuery.Open strSelect & " " & strFrom & " " & strWhere & " " &
strOrderBy, strConnection, , , adCmdText
If blnConnected = False Then Set RunQuery.ActiveConnection = Nothing
Exit Function
ErrorHandler:
modErrors.HandleError m_cModule, "RunQuery"
End Function