Creating a recordset froma query

A

AlecJames

Access 2003.
I've got a form with a button. In the click event I want to create a
recordset from the result of running a stored query. I don't want to display
the query, just use the data it creates to load a recordset so that I can
recover and process information from multiple records from the query result.
The query must take a parameter that I get from my form - I can get the
parameter ok, I cannot find out how to create the record set and load it from
the query-

Dim rs as Recordset

set rs = "the result of my stored query"(taking this parameter) ' ? this is
the part I cannot do

Thanks
Alec
 
B

Brian

Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("<YourQueryName>", dbOpenSnapshot)

Look at the help for OpenRecordset for other options. You can include a
reference to [Forms]![YourForm]![YourField] in the query itself.
 
Top