Query getting the parameters from Form

  • Thread starter Thread starter Hameed
  • Start date Start date
H

Hameed

Guest
Hi Experts,

I have a Query, which is getting the parameters from a form. On ther other Hand, I would like to store the Query result in a recordset which I defined in VBA, dynamically. The code for this function is attached to a command button. When i press the command button, the query should be executed according to the paramaters given on the form, and result should be stored in the recordset.

Please somebody advise, what should I do?

Regards,
Hameed
 
Check this.....

the click event of the button must have a code like this...


docmd.openQuery "QueryName"


right?

open ur query in design mode and goto its SQL editor. copy the code and come to the click event of ur button....
before the docmd.open..... command, write this


set rs=db.openrecordset("Paste here the SQL statments from query....")

docmd.openQuery "queryName"

it will record the result in rs and then run the query...


Hope it works

Thanx
 
To make this easier, I'm sure you can amalgamate everblue's suggestion into this

Set rs = db.OpenRecordset("QueryName")

But, what exactly do you mean by store the information in a Recordset? A recordset is used primarily to manipulate data via vbacode, what is the reason for showing the query and storing the data in a recordset also?
 

Users who are viewing this thread

Back
Top Bottom