hi,
i am connecting to an instance of SQL server and selecting some records from a table. In Access the query takes 45 seconds to run. When I do the same thing in Excel it takes a second.
Does anyone have any idea why this would happen. Everything is the same between the access and excel query so Im not sure why it would be so much slower?
The query is a very simple one :-
myDate = DateAdd("d", -90, Date)
deletedDate = Year(myDate) & "-" & Right("000" & Month(myDate), 2) & "-" & Right("000" & Day(myDate), 2)
sqlDeleted = "SELECT colA,colB FROM tblA WHERE CAST(colB AS Datetime) > '" & deletedDate & "' AND colC='TIME';"
Set RSTDeleted = New ADODB.Recordset
With RSTDeleted
.ActiveConnection = DBConn
.CursorLocation = adUseClient
.Open sqlDeleted
End With
Many thanks
Phil