Creating a recordset froma query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 

Ask a Question

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.

Ask a Question

Back
Top