Query from a pull down menu...

  • Thread starter Thread starter denelson
  • Start date Start date
D

denelson

Alrighty,

I decided to try my approaches of querying through a different
manner.... I have a table... has different fields in it... There is one
field called Type, which is a look up value it pulls from a table...
has about 30 or so values. I want to create a form with this pull down
menu and have a submit button. When the submit button is hit, it will
run a query for all records which match that "Type"... How can I go
about doing this?
 
Reference the control on the form as a parameter in the query:

SELECT *
FROM YourTable
WHERE Type = Forms!YourForm!YourComboBox;

Just open the query, or better still a form or report based on it, from the
button's Click event procedure.

Ken Sheridan
Stafford, England
 
What do you mean reference the control on the form as a parameter
query? I'm confused on that step. Thanks for the help!
 
In query design view put the reference in the 'criteria' row of the Type
column in the query design grid, e.g. Forms![YourForm]![YourComboBox],
changing the form and control name to your own of course.

The form must be open when the query runs, which it will be when you open
it, or a form or report based on it, from the form. If you try to open the
query directly from the database window while the form is not open it will
prompt you for the value, acting in the same way as a simple parameter query.

Ken Sheridan
Stafford, England
 
Back
Top