(Q) How do I open a Parameter Query from code?
(A) In order to open parametric queries, you need to explicitly pass each parameter by
using the Parameters property before opening a recordset based on the query.
For example, in the following code snippet, the Query "Qry1" has two
parameters; namely, [Please enter Code:] and [Please enter city:].
Dim db As Database
Dim rs As Recordset
Dim qdfParmQry As QueryDef
Set db = CurrentDb()
Set qdfParmQry = db.QueryDefs("Qry1")
qdfParmQry("Please Enter Code:") = 3
qdfParmQry![Please Enter City:] = "New York"
Set rs = qdfParmQry.OpenRecordset()
|