Parameter query with OpenForm method

G

Guest

I have a parameter query that selects the data I want. Now I want the user to
be able to open my form from a command button (using the OpenForm method),
with the query as the basis for the data they see. I thought I could do this
just using my query name as the filter name. But when I run it, all the
records are returned in the form.

I hope I am explaining this properly - any suggestions would be much
appreciated.
 
G

Guest

Jen,
setting the Record Source for the form to be opened, to your query name,
should give you the results you want, which is the obvious answer... That
being said, there must be more to your problem than what is pointed out in
your post. Is this a bound form?
If you have no need for the query itself you could just open it up in SQL
view and then copy all of the SQL code then open your form in design view
righ click on the Record Source then select zoom and paste your SQL. Then you
can delete the query if you have no further need of it. This is also a good
way to become familiar with the SQL language as you are going to want to do
as you progress and desire more complexity out of your database. Let me know
if you need more help.
Take Care & God Bless ~ SPARKER ~
 
G

Guest

I figured it out - I was entering the filter name without the quotations
(such a dumb mistake!!). I wish the "helper" floaty box that comes up in VB
would be more specific about which arguments are strings (and therefore need
quotes) and which aren't.

Thanks for your help!
 
D

David C. Holley

I would take the parameters out of the query making it just a vanilla
SELECT and then use the WHERE parameter of the DoCmd.OpenForm to select
the specific records to be displayed.
 

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