how do i get a value in 1 combo box to filter a selection in a se.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 list/combo boxes on a form. From the first I can select a specific
manufacturer from a list in a table. I want to be able to have a second box
that only gives me a dropdown choice of equipment makes from the manufacturer
selected in the first box rather than equipment from all manufacturers.
 
The second list/combobox will need to be based on a paramete query that
evaluates the value of the first list/combobox.

With your form in open design mode and the query your second listbox will
use in design mode, under the appropriate field "build" the parameter by
pointing the open form and the name of the first droplist.
 
I have 2 list/combo boxes on a form. From the first I can select a specific
manufacturer from a list in a table. I want to be able to have a second box
that only gives me a dropdown choice of equipment makes from the manufacturer
selected in the first box rather than equipment from all manufacturers.

Leave the rowsource of the 2nd combo box blank.
Code the AfterUpdate event of the 1st combo box to fill the rowsource
of the 2nd.
Something like this:
Combo2.Rowsource = "Select Instructors.InstructorID,
Instructors.InstructorName from Instructors Where Instructors.ClassID
= " & Me!ComboName & ";"

Change the table and field names as needed.
The above assumes ClassID is a Number datatype and the combo box bound
column is Number also.
 
This is asked frequently, but this is probably the first time you have asked
it. I do the following


Example: I have a table called TypeDef which has columns for Type(the type
code), TypeText (description of type) and Category (for the next combobox)

In the first combo box (cboItem) I just extract the distinct categories
found in the TypeDef table with a GROUP BY query. This query is the row
source for that combobox. (go to the data tab of the combobox properties)
SELECT [category] FROM typedef GROUP BY [category];

In the row source for the second combo box, I include columns for the type
code and description and use a where clause to filter by the value in the
first combo box.

SELECT [type], [typetext] FROM typedef WHERE category = me.cboItem;
 
If you understand this answer, you don't need to ask the question. I think
he is refering to something like the solution I sent you. Fredg's answer is
also a good way to go but requires a little VBA programming.
 
Back
Top