You can set the value of the parameters like this:
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Set db = CurrentDb()
Set qdf = db.QueryDefs("Query1")
qdf.Parameters("MyParameter") = MyValue
qdf.Parameters("[Forms]![Form1]![Text0]") = Forms!form1!Text0
qdf.Execute, dbFailOnError
In general, I find it easier to build the SQL statement with the literal
values patched in. It's much more flexible, e.g. where you might want to
treat some parameters as optional.
The other option if you are referring to controls on a form is to use
RunSQL, but it suffers from the limitations discussed in this article:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html