Which is quicker / better / more efficient? (1 Viewer)

petehilljnr

Registered User.
Local time
Today, 00:37
Joined
Feb 13, 2007
Messages
192
Using DAO in Excel connecting to an Access database, which is the better of these methods to get my recordset:

a) Create the query in Access then connect to it using
Code:
set rst = MyDB.OpenRecordset("MyQuery")

or

b)
Code:
strSQL = "SELECT MyID, MyField, Count(MyNumber) as MyCount FROM MyTable"

set rst = MyDB.OpenRecordset(strSQL)

Or are they much they same (performance wise)?

Both work and neither ~seem~ to be quicker than the other I use the second method if I have to pass in parameters in the SQL string but was just wondering if one way was better than the other?

Pete
 

KeithG

AWF VIP
Local time
Today, 00:37
Joined
Mar 23, 2006
Messages
2,592
I would think option A would be more efficent because access has already optimized the SQL because it is a saved query.
 

Users who are viewing this thread

Top Bottom