T
Tony_VBACoder
I have a bunch of Parameter Queries that I have been
calling with VBA. But now I am converting my code to use
ADO recordsets. How would I change my old code to ADO
(see below)?
Private Sub GetParameterQuery()
Dim dbs As Database, rst As Recordset, qdf As QueryDef
' Set database variable to current database.
Set dbs = CurrentDb
' Set the QueryDef object
Set qdf = dbs.QueryDefs("qryMyParameterQuery")
' Set the parameters of the query
qdf.Parameters("[Start Year]") = 2000
qdf.Parameters("[End Year]") = 2004
' Open Recordset object
Set rst = qdf.OpenRecordset()
calling with VBA. But now I am converting my code to use
ADO recordsets. How would I change my old code to ADO
(see below)?
Private Sub GetParameterQuery()
Dim dbs As Database, rst As Recordset, qdf As QueryDef
' Set database variable to current database.
Set dbs = CurrentDb
' Set the QueryDef object
Set qdf = dbs.QueryDefs("qryMyParameterQuery")
' Set the parameters of the query
qdf.Parameters("[Start Year]") = 2000
qdf.Parameters("[End Year]") = 2004
' Open Recordset object
Set rst = qdf.OpenRecordset()