Datasheet view of Parameter Query

L

Larry

I need to write some code that will pass parameters to a query, based on
input from a form, then open that query in datasheet view.

I know how to set parameters using QueryDefs, then use that as a recordset.
But in this case, after I set the parameters, I want to open the query to
view the results.

I could probably do this with a form, but I really don't need the form. Just
the query results. Can this be done?
 
J

JohnFol

Why not do

DoCmd.OpenQuery "query1", acViewNormal

and in the query just set the parameters to reference the form ie

SELECT * FROM MyTable WHERE MyField = [forms]![form1]![text1]
 
L

Larry

Thank you for stating the obvious! I missed that option totally!

That's what I get for trying to make it harder than it needed to be.

JohnFol said:
Why not do

DoCmd.OpenQuery "query1", acViewNormal

and in the query just set the parameters to reference the form ie

SELECT * FROM MyTable WHERE MyField = [forms]![form1]![text1]




Larry said:
I need to write some code that will pass parameters to a query, based on
input from a form, then open that query in datasheet view.

I know how to set parameters using QueryDefs, then use that as a recordset.
But in this case, after I set the parameters, I want to open the query to
view the results.

I could probably do this with a form, but I really don't need the form. Just
the query results. Can this be done?
 

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

Top