Dim db As DAO.Database
Dim qd As DAO.Querydef
Dim prm As Parameter
Dim rs As DAO.Recordset
Set db = CurrentDb
Set qd = db.Querydefs("yourqueryname")
For Each prm In qd.Parameters
prm.Value = Eval(prm.Name)
Next prm
Set rs = qd.OpenRecordset
Thus if the parameter is a form reference, the string
[Forms]![SomeFormName]![SomeControl] will be evaluated to return the
value in that control, and that value will be assigned to the
parameter's value.