combo-box filtering using a second combo-box

acoon

New member
Local time
Today, 15:07
Joined
Dec 25, 2007
Messages
8
I have a table with details about hotels including their name and address.

In one of my forms I have a combo-box where I can select the hotel area and a second combo-box that display the name of only the hotels that are in the area selected in the first combo-box.

My problem is that in certain cases I would like to view all of the hotels in the second combo-box, how can I add that option in the first combo box?
 
For the RowSource of your second cbo use:

Code:
SELECT YourField FROM YourTable UNION SELECT "<All>" FROM YourTable;

Then in the AfterUpdate event

Code:
Private Sub SecondCombobox_AfterUpdate()
 If Me.SecondCombobox = "<All>" Then 
   'Code to show all records for area goes here
 End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom