Multiple combo box to filter result

  • Thread starter Thread starter Squid
  • Start date Start date
S

Squid

I want to create a multi combo boxes to drill down a
result.

Combobox1 - Class of work
Combobox2 - Type of worker
Combobox3 - Area worked

The values contained in combobox2 are dependent upon the
class of work the user chooses in combobox1. The values
contained in combobox3 are dependent upon the type of
worker the user chooses in combobox3.

How would I do something like this?

TIA
Mike
 
If you are doing it in a form it's pretty simple. In design veiw go to the "Properties" sheet of the combo box and click on the "Data" tab. In "Row Source" use an SQL statement to select the data. In your case I beleive it would be something like "SELECT [TableName].[Type of Worker] FROM [TableName] WHERE ((([TableName].[Class of work])=([Forms]![FormName]![Combobox1])));" If it's in a subform you would replace "([Forms]![FormName]![Combobox1])" with "([Forms]![FormName]![SubformName Subform]![Combobox1])" To refresh the data you have to use a requery action. There is another posted thread that explains how to do that with VB code. To get around the code you have to use a Macro and the "Requery" action. However, the macro won't work if the combo boxes are in a subform.
I hope that helps.
 
I want to create a multi combo boxes to drill down a
result.

Combobox1 - Class of work
Combobox2 - Type of worker
Combobox3 - Area worked

The values contained in combobox2 are dependent upon the
class of work the user chooses in combobox1. The values
contained in combobox3 are dependent upon the type of
worker the user chooses in combobox3.

How would I do something like this?

Essentially, base Combobox2 on a Query which references Combobox1, and
requery Combobox2 in the AfterUpdate event of Combobox1.

There's sample code at http://www.mvps.org/access/forms/frm0028.htm
which you might want to adapt.
 
Back
Top