List box displays values based on multiple combo box selections

G

Guest

I’d like to make a list box dependent on multiple combo box selections, but
start out fully populated with all the records from the one table. For
example, when the database first loads, the list box displays all the
records. After selecting “Adult†from cb_age, the list box will display only
the matching records. Then, after selecting “California†from cb_location,
the list box will display all the records matching “Adult†and “California.â€
If cb_age is changed to “Child,†then the list box displays all records
matching “Child†and “California.†Etc. etc. I’d like to do this with as many
as five different combo boxes that will all affect the list box. I really
don’t know where to begin with this one, so any help would be greatly
appreciated!

Here’s what I have:

List Box lb_main
Combo Box cb_age
Combo Box cb_location
Combo Box cb_general

Lb_main is populated with data from tlb_main. Tbl_main has fields with
values (age, location, general) dependent on other tables (tbl_age,
tbl_location, tbl_general).
 
M

Marshall Barton

BC said:
I’d like to make a list box dependent on multiple combo box selections, but
start out fully populated with all the records from the one table. For
example, when the database first loads, the list box displays all the
records. After selecting “Adult” from cb_age, the list box will display only
the matching records. Then, after selecting “California” from cb_location,
the list box will display all the records matching “Adult” and “California.”
If cb_age is changed to “Child,” then the list box displays all records
matching “Child” and “California.” Etc. etc. I’d like to do this with as many
as five different combo boxes that will all affect the list box. I really
don’t know where to begin with this one, so any help would be greatly
appreciated!

Here’s what I have:

List Box lb_main
Combo Box cb_age
Combo Box cb_location
Combo Box cb_general

Lb_main is populated with data from tlb_main. Tbl_main has fields with
values (age, location, general) dependent on other tables (tbl_age,
tbl_location, tbl_general).


Create a query that retrieves all the needed fields. For
each field that corresponds to a combo box, use a criteria
like:

=Forms![your form].cb_age Or Forms![your form].cb_age Is
Null

Another way is to (re)construct the list box's RowSource
query in each combo box's AfterUpdate event procedure. This
would be somewhat more efficient, but it involves a fair
amount of code.
 
G

Guest

Thanks for your reply! I decided to go the code route and was able to figure
it out (although it took me awhile).

Marshall Barton said:
BC said:
I’d like to make a list box dependent on multiple combo box selections, but
start out fully populated with all the records from the one table. For
example, when the database first loads, the list box displays all the
records. After selecting “Adult†from cb_age, the list box will display only
the matching records. Then, after selecting “California†from cb_location,
the list box will display all the records matching “Adult†and “California.â€
If cb_age is changed to “Child,†then the list box displays all records
matching “Child†and “California.†Etc. etc. I’d like to do this with as many
as five different combo boxes that will all affect the list box. I really
don’t know where to begin with this one, so any help would be greatly
appreciated!

Here’s what I have:

List Box lb_main
Combo Box cb_age
Combo Box cb_location
Combo Box cb_general

Lb_main is populated with data from tlb_main. Tbl_main has fields with
values (age, location, general) dependent on other tables (tbl_age,
tbl_location, tbl_general).


Create a query that retrieves all the needed fields. For
each field that corresponds to a combo box, use a criteria
like:

=Forms![your form].cb_age Or Forms![your form].cb_age Is
Null

Another way is to (re)construct the list box's RowSource
query in each combo box's AfterUpdate event procedure. This
would be somewhat more efficient, but it involves a fair
amount of code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top