T
tcb
On an autoexec function several recordsets are opened. Some are
queries to local tables, some are to sql server tables.
I have been trying to optimize performance but I haven't seen much
difference in speed between queries run directly against linked SQL
Server tables vs pass through queries. Here is my code for creating
the pass throughs (I have another function OpenRecordSetLocal that
handles queries to tables within the frontend. The ODBC connection
string resides in the query Q_PassThrough.
Am I missing something key? Is there a better way to do this?
Thanks.
Function OpenRecordset(sql As String)
On Error Resume Next
Dim DB As Database, rs As DAO.Recordset
Set DB = CurrentDb()
CurrentDb.QueryDefs("Q_PassThrough").sql = sql
Set rs = DB.OpenRecordset("Q_PassThrough")
Set OpenRecordset = rs
Exit Function
Err_OpenRecordset:
MsgBox Error(Err), vbInformation, "DATA ERROR"
Debug.Print "Data Error"
Exit Function
End Function
queries to local tables, some are to sql server tables.
I have been trying to optimize performance but I haven't seen much
difference in speed between queries run directly against linked SQL
Server tables vs pass through queries. Here is my code for creating
the pass throughs (I have another function OpenRecordSetLocal that
handles queries to tables within the frontend. The ODBC connection
string resides in the query Q_PassThrough.
Am I missing something key? Is there a better way to do this?
Thanks.
Function OpenRecordset(sql As String)
On Error Resume Next
Dim DB As Database, rs As DAO.Recordset
Set DB = CurrentDb()
CurrentDb.QueryDefs("Q_PassThrough").sql = sql
Set rs = DB.OpenRecordset("Q_PassThrough")
Set OpenRecordset = rs
Exit Function
Err_OpenRecordset:
MsgBox Error(Err), vbInformation, "DATA ERROR"
Debug.Print "Data Error"
Exit Function
End Function