Search Multiple Items Using Combo boxes and List boxes

Download Sample Access File:
Search Multiple Items Using Combo boxes and List boxes
(Version 2010 +)

This is an example of using the Combo box and List box in combination to search in the formation in two different fields. The data in the 2nd Combo box or the 2nd List box is depending on the selection from the 1st Combo box or the 1st List box. In this sample file, I used the Customer table to search for the customers by the State and City.

There are two different type of searching using combo box and list box in this sample file:

1. Search with 1 Combo box and 1 List box
2. Search with 2 Combo boxes and 2 List boxes

Search with 1 Combo box and 1 List box

Highlight functions or features in this form include:

1.Search Single State

You can select one state from the State combo box to search for a single state. After you select the state from the list, the result will display on the sub-form below. In the example below, the state “CA” is selected from the combo box dropdown list.

2.Search Multiple States

You can select multiple states for searching. The Combo box and List box are used together for this method. When the user selects the <Select Multiple> option on top of all states in the Combo box, the List box will display all states under the Combo box. The user can select multiple states from the List box. In the example below, the states “CO,MA” are selected from the List box. After click Search icon, the Sub-Form will display the customers from these states as shown below.

3.Preview and Print Report from the Search Result

You can preview or print the report from the search result same result as you see on the sub-form. Every time you change the selection on the state, the report will change as well.

4.Clear Selection and Sub-Form

After you click Clear icon, it will clear the Combo box, List box, and Sub-Form will be empty. The List box will be minimized and hidden. It is ready for next selection.

 

Search with 2 Combo boxes and 2 List boxes

Highlight functions or features in this form include:

1.Search Single State

You can select one state from the State combo box to search for a single state. After you select the state from the list, the result will display on the sub-form below. You don’t have to click Search icon because you select only one state. In the example below, the state “CA” is selected from the combo box dropdown list.

2.Search Multiple States

You can select multiple states for searching. The Combo box and List box are used together for this method. When the user selects <Select Multiple> option on top of all states in the Combo box, the List box will display under the Combo box for the user to select multiple states. In the example below, the states “CA, NV, NY” are selected from the List box. After click Search icon, the Sub-Form will display the customers from these states as shown below.

3.Search Single City

You can select a city from the City combo box to search for one city without selecting the state. After you select the city from the list, the result will display on the sub-form below. In the example below, the city “Los Angeles” is selected from the combo box dropdown list.

4.Search Multiple Cities

You can select multiple cities for searching. When the user selects <Select Multiple> option on top of all cities in the Combo box, the List box will display under the Combo box. The user can select multiple cities from the List box. In the example below, the cities “Denver, Los Angeles” are selected from the List box.

5.City list is depending on the selected states

After the user selected multiple states from the State List box, the city list will be updated on both combo box and list box corresponding to the selected states from the State Combo box. For example below, the states “CA, NV, NY” are selected from the List box, you will see only 7 cities in the city list for City Combo box.

6.Combination of Selecting State and City

The user can select only one city from the city list after selecting multiple states from the State List box. The result will display right away after selecting one city from the city combo box. The user does not need to click the Search icon. The Search is only needed if selecting multiple states or multiple cities from the list box.

7.Select the Multiple Cities from Multiple States

After selecting multiple states from the State List box, the user can select <Select Multiple> option from the combo box and can select multiple cities from the city list box. The user must click the Search icon to see the result.

8.Preview and Print Report from the Search Result

You can preview or print the report from the search result same result as you see on the sub-form. Every time you change the selection on the state and city, the report will change as well.

9.Clear Selection and Sub-Form

After you click Clear icon, it will clear all two Combo boxes, two List boxes, and Sub-Form. The List boxes will be minimized and hidden. It now is ready to start searching for the new selection again.

10.Add Note on Code

I also add some comments on the VB code for understanding.

The Download File Include:

1 table, 3 forms, 1 report, and 1 module

Related Video:

 

 

Related posts