access2007 performance - recordsource vs recordset -
06-09-2011
, 11:07 AM
qryPartsQuote is a linked table to a sql server 2005 view
running the select statement in the management studio takes less than
a second
the following is in a form's open event (using access2007)
originally the recordsource statement was used, but the timing shows a
3 sec hit to set the recordsource
yet when I add the two 'set ' statement, they take 1 sec and the
recordsource statement still takes 3 secs
strSql = "SELECT * FROM qryPartsQuote WHERE partsQuoteId =
278"
Debug.Print Time
Set rs = CurrentDb.OpenRecordset(strSql)
Set .Recordset = rs
Debug.Print Time
.RecordSource = strSql
Debug.Print Time
since the above demonstrates two ways of setting the recordsource
and since the 'set .recordset = rs' statement sets the form's
recordsource
is there a downside to using
Set rs = CurrentDb.OpenRecordset(strSql)
Set .Recordset = rs
instead of
.RecordSource = strSql
to set the recordsource ?
I wonder why one method is faster than the other ? |