Here is an example of using DAO and QueryDef the long way. I am going to include this here as reference.
I got this example from Microsoft here
http://msdn.microsoft.com/en-us/libr...ffice.14).aspx
Code:
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Set dbs = CurrentDb
'Get the parameter query
Set qfd = dbs.QueryDefs("qryMyParameterQuery")
'Supply the parameter value
qdf.Parameters("EnterStartDate") = Date
qdf.Parameters("EnterEndDate") = Date + 7
'Open a Recordset based on the parameter query
Set rst = qdf.OpenRecordset()
I am posting it here because it helps to show what the function that Orange linked to does. Only, the function incorporates the Eval() function to keep things dynamic. I just wanted to give it a mention before I mark the thread Solved.
My vote for the best approach is to incorporate the Eval function within the SQL in the Query object. I don't see there being a performance benefit to writing the extra VBA and using QueryDefs.
Thanks to all that participated!