How apply filter to Combo Box

R

RICHARD BROMBERG

I have a table called PHONE.

The table contains fields for FIRST, LAST, CATEGORY and some others.



I have a combo box named Cmbo_First_Last_Name with a row source of QUERY1.

QUERY1 is a simple query that includes the FIRST and LAST name of all
records in the PHONE table.



When I click on this combo box it brings up a list of FIRST and LAST names
from the PHONE table.



I want to apply a filter to this combo box so that I can select a CATEGORY
(see below) and have Cmbo_First_Last_Name display only those records which
match a single CATEGORY.







I also have a combo box named Cmbo_Select_Category.

The row source is SELECT DISTINCT [phone].[CATAGORY] FROM phone;

When I click on this combo box it brings up a list of distinct categories.



How do I use the category selected from Cmbo_Select_Category to act as a
filter .
 
G

Guest

Put Cmbo_Select_Category in the Tab Order so it is before Cmbo_First_Last_Name.
Use the After Update event of Cmbo_Select_Category to requery
Cmbo_First_Last_Name.
Change Query1 to include WHERE [Category] = '" & Me.Cmbo_Select_Category &"'"

Private Sub Cmbo_Select_Category_After_Update()
Me.Cmbo_Select_First_Last_Name.Requery
End Sub

Now Cmbo_First_Last_Name will only show names for the selected Category.
 

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