The easiest explanation here is probably just an example.
Dim rst As DAO.Recordset, db As DAO.Database
Dim qdf As DAO.QueryDef, prm As DAO.Parameter
Set db = CurrentDb
Set qdf = db.QueryDefs("MyQuery")
Set prm = qdf.Parameters("[Forms]![Form1]![Textbox1]")
prm = 21
Set rst = qdf.OpenRecordset
'other stuff here
rst.Close
Set rst = Nothing
Set prm = Nothing
Set qdf = Nothing
Set db = Nothing
If you have more than one parameter, use a different parameter variable for
each parameter. Set each one to the name of the parameter in the query then
set the value of each one prior to opening the recordset.
--
Wayne Morgan
MS Access MVP
"AccessUser" <sh******@bezeqint.net> wrote in message
news:42********@news.bezeqint.net...
Hi.
Can you help me on that:
I want to use OpenRecordset to open a query.
Normally, the query gets some parameters from a form.
How do I pass the same parameters to the Recordset I want to open?