Parameter Query using combo box?

D

Dino

I'm pretty new at this, and I have not been able to follow the answers to
similar questions as this one. I have created a form based on a parameter
query that prompts for a company name. Everything works fine, and the correct
information comes up after one types the name. But, instead of users having
to type the company name, I'd like to have them just select from a drop-down
list, and then the query will run. If anyone can help, I need basic step by
step instructions on how to set this up. Thanks!
Dino
 
K

Klatuu

You will need to create a form that has the combo box on it. The row source
for the combo box will need to be it's own query that retrieves all the
company names.
To do that, select the combo box in design mode. Right click and select
properties.
Select the Row Source property. Use the drop down to select the table where
the company names are. Once you have that selected, click on the button with
3 dots. It will open up the query builder. Select the field with the
company name and close the query builder. It will ask you if you want to
create a query based on the table. Answer yes. You will then see an SQL
SELECT statement in the Row source box.

Then use the After Update event of the combo box.
To do that, select the combo box in design mode. Right click and select
properties. Now select the Events tab. Place your cursor in the After
Update box and click on the button with 3 dots on it just to the right.
Select Macro Builder.
Create a macro that runs your query.

Now, we have to set the query up for filtering by company. In design mode
of the query. select the Criteria row of the field that has the company names
in it.
enter forms![YourFormsName]![YourCombBoxName]
That will cause the query to filter on the company name selected in the
combo box.
 
D

Dino

I tried it but I got stuck at one point. When I am in query builder, I
selected the field with the company names in it, then closed the query
builder. It would not ask me whether I wanted to create a query, it just
closed and I was back to the form.


Klatuu said:
You will need to create a form that has the combo box on it. The row source
for the combo box will need to be it's own query that retrieves all the
company names.
To do that, select the combo box in design mode. Right click and select
properties.
Select the Row Source property. Use the drop down to select the table where
the company names are. Once you have that selected, click on the button with
3 dots. It will open up the query builder. Select the field with the
company name and close the query builder. It will ask you if you want to
create a query based on the table. Answer yes. You will then see an SQL
SELECT statement in the Row source box.

Then use the After Update event of the combo box.
To do that, select the combo box in design mode. Right click and select
properties. Now select the Events tab. Place your cursor in the After
Update box and click on the button with 3 dots on it just to the right.
Select Macro Builder.
Create a macro that runs your query.

Now, we have to set the query up for filtering by company. In design mode
of the query. select the Criteria row of the field that has the company names
in it.
enter forms![YourFormsName]![YourCombBoxName]
That will cause the query to filter on the company name selected in the
combo box.

Dino said:
I'm pretty new at this, and I have not been able to follow the answers to
similar questions as this one. I have created a form based on a parameter
query that prompts for a company name. Everything works fine, and the correct
information comes up after one types the name. But, instead of users having
to type the company name, I'd like to have them just select from a drop-down
list, and then the query will run. If anyone can help, I need basic step by
step instructions on how to set this up. Thanks!
Dino
 
K

Klatuu

Try clicking on Save. It may ask you for a query name to save it as.

Dino said:
I tried it but I got stuck at one point. When I am in query builder, I
selected the field with the company names in it, then closed the query
builder. It would not ask me whether I wanted to create a query, it just
closed and I was back to the form.


Klatuu said:
You will need to create a form that has the combo box on it. The row source
for the combo box will need to be it's own query that retrieves all the
company names.
To do that, select the combo box in design mode. Right click and select
properties.
Select the Row Source property. Use the drop down to select the table where
the company names are. Once you have that selected, click on the button with
3 dots. It will open up the query builder. Select the field with the
company name and close the query builder. It will ask you if you want to
create a query based on the table. Answer yes. You will then see an SQL
SELECT statement in the Row source box.

Then use the After Update event of the combo box.
To do that, select the combo box in design mode. Right click and select
properties. Now select the Events tab. Place your cursor in the After
Update box and click on the button with 3 dots on it just to the right.
Select Macro Builder.
Create a macro that runs your query.

Now, we have to set the query up for filtering by company. In design mode
of the query. select the Criteria row of the field that has the company names
in it.
enter forms![YourFormsName]![YourCombBoxName]
That will cause the query to filter on the company name selected in the
combo box.

Dino said:
I'm pretty new at this, and I have not been able to follow the answers to
similar questions as this one. I have created a form based on a parameter
query that prompts for a company name. Everything works fine, and the correct
information comes up after one types the name. But, instead of users having
to type the company name, I'd like to have them just select from a drop-down
list, and then the query will run. If anyone can help, I need basic step by
step instructions on how to set this up. Thanks!
Dino
 
D

Dino

Hmmm...it didn't. I clicked on "save", and the window just closed and dumped
me back onto the query builder screen.


Klatuu said:
Try clicking on Save. It may ask you for a query name to save it as.

Dino said:
I tried it but I got stuck at one point. When I am in query builder, I
selected the field with the company names in it, then closed the query
builder. It would not ask me whether I wanted to create a query, it just
closed and I was back to the form.


Klatuu said:
You will need to create a form that has the combo box on it. The row source
for the combo box will need to be it's own query that retrieves all the
company names.
To do that, select the combo box in design mode. Right click and select
properties.
Select the Row Source property. Use the drop down to select the table where
the company names are. Once you have that selected, click on the button with
3 dots. It will open up the query builder. Select the field with the
company name and close the query builder. It will ask you if you want to
create a query based on the table. Answer yes. You will then see an SQL
SELECT statement in the Row source box.

Then use the After Update event of the combo box.
To do that, select the combo box in design mode. Right click and select
properties. Now select the Events tab. Place your cursor in the After
Update box and click on the button with 3 dots on it just to the right.
Select Macro Builder.
Create a macro that runs your query.

Now, we have to set the query up for filtering by company. In design mode
of the query. select the Criteria row of the field that has the company names
in it.
enter forms![YourFormsName]![YourCombBoxName]
That will cause the query to filter on the company name selected in the
combo box.

:

I'm pretty new at this, and I have not been able to follow the answers to
similar questions as this one. I have created a form based on a parameter
query that prompts for a company name. Everything works fine, and the correct
information comes up after one types the name. But, instead of users having
to type the company name, I'd like to have them just select from a drop-down
list, and then the query will run. If anyone can help, I need basic step by
step instructions on how to set this up. Thanks!
Dino
 
T

Teri

Not sure if you got all your answers to this, but had a thought when I was
scrolling thru and saw your post. Try File, Save As (not Save). Not sure if
it will do the trick or not, but worth a shot.

Teri.

Dino said:
Hmmm...it didn't. I clicked on "save", and the window just closed and dumped
me back onto the query builder screen.


Klatuu said:
Try clicking on Save. It may ask you for a query name to save it as.

Dino said:
I tried it but I got stuck at one point. When I am in query builder, I
selected the field with the company names in it, then closed the query
builder. It would not ask me whether I wanted to create a query, it just
closed and I was back to the form.


:

You will need to create a form that has the combo box on it. The row source
for the combo box will need to be it's own query that retrieves all the
company names.
To do that, select the combo box in design mode. Right click and select
properties.
Select the Row Source property. Use the drop down to select the table where
the company names are. Once you have that selected, click on the button with
3 dots. It will open up the query builder. Select the field with the
company name and close the query builder. It will ask you if you want to
create a query based on the table. Answer yes. You will then see an SQL
SELECT statement in the Row source box.

Then use the After Update event of the combo box.
To do that, select the combo box in design mode. Right click and select
properties. Now select the Events tab. Place your cursor in the After
Update box and click on the button with 3 dots on it just to the right.
Select Macro Builder.
Create a macro that runs your query.

Now, we have to set the query up for filtering by company. In design mode
of the query. select the Criteria row of the field that has the company names
in it.
enter forms![YourFormsName]![YourCombBoxName]
That will cause the query to filter on the company name selected in the
combo box.

:

I'm pretty new at this, and I have not been able to follow the answers to
similar questions as this one. I have created a form based on a parameter
query that prompts for a company name. Everything works fine, and the correct
information comes up after one types the name. But, instead of users having
to type the company name, I'd like to have them just select from a drop-down
list, and then the query will run. If anyone can help, I need basic step by
step instructions on how to set this up. Thanks!
Dino
 
Top