Hi all,
I am trying to execute a query using Microsoft Access that has linked tables to a SQL server database. When I execute the query in Access, the results are returned almost instantly. However, when I run it through VBA, using a recordset, the recordset takes about 11 seconds to create.
The command I am using for the recordset is:
Where strSQL is obtained from the Access query using the following code:
It is only the "Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)" that is slow, the rest of the code seems to work well.
If anyone has any ideas why this is runnig so slowly, or how it can be sped up then please let me know.
Thanks
Andy
I am trying to execute a query using Microsoft Access that has linked tables to a SQL server database. When I execute the query in Access, the results are returned almost instantly. However, when I run it through VBA, using a recordset, the recordset takes about 11 seconds to create.
The command I am using for the recordset is:
Code:
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
Where strSQL is obtained from the Access query using the following code:
Code:
Set qry = CurrentDb.QueryDefs("qryName")
strSQL = qry.SQL
If anyone has any ideas why this is runnig so slowly, or how it can be sped up then please let me know.
Thanks
Andy