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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.