Run a query after selecting from combo box

H

Haas C

Hi all!

I have a form on which I created a combo box which lists out the
Company field in the table TblCompanies. After I select a Company on
this Combo Box (Combo0), I next want to run a query to return me some
info on that company. For that purpose, I put a Command Box (Command2)
which is supposed to run a query which would get me the relevant info.
However, it lists out info for all companies and doesn't pick up the
Company from the Combo box. How do I link the company I choose in the
combo box to be run by the query and and return only the relevant info
for that company? I haven't done any programming - just used the
Toolbox to create the Combo box and Command Button to run the specific
query.

Thanks in advance.
 
M

Mike Painter

If the tables are properly related then selecting the company should
automatically fill the other fields if they are on the same form.
If the information is on a subform then setting the Master Child
relationsship is all that is needed,

Access has a ton of samples and the Northwind data base has examples of
doing this in several ways.
 
H

Haas C

If the tables are properly related then selecting the company should
automatically fill the other fields if they are on the same form.
If the information is on a subform then setting the Master Child
relationsship is all that is needed,

Access has a ton of samples and the Northwind data base has examples of
doing this in several ways.







- Show quoted text -

Thanks for the reply but i don't think you understood my question as I
may have been vague. I want to select an item from a combo box, use
that value as a parameter for a query, and display query results as if
I had double clicked on the query by itself. Yes, it is a parameter
query. i figured out how to do it - within the criteria of the query,
I used [FORMS]![FRM_BoundPrograms]![Comb0] - however, I get blank
results. Any help there please?
 
M

Mike Painter

Above you say it shows all companies and below you say it shows none.
Assuming the original form is still open,
"[FORMS]![FRM_BoundPrograms]![Comb0]" is valid, and you are running the
proper query from a command line it should work.
Comb0 should return the key to the company and the criteria should go in
that field.
Thanks for the reply but i don't think you understood my question as I
may have been vague. I want to select an item from a combo box, use
that value as a parameter for a query, and display query results as if
I had double clicked on the query by itself. Yes, it is a parameter
query. i figured out how to do it - within the criteria of the query,
I used [FORMS]![FRM_BoundPrograms]![Comb0] - however, I get blank
results. Any help there please?
 

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