View Full Version : Conditionally Change a ComboBox RowSource from one Query to another.


Pat Wood
12-21-2006, 09:20 AM
Here is a simple sub I wrote to use when I need to use different Queries for the same ComboBox:

Private Sub MycboBox_GotFocus()

If Me!myCheckBox = True Then
Me!MycboBox.RowSource = "Query1"
Else
Me!MycboBox.RowSource = "Query2"
End If
End Sub

I have a table for "Members" and one for "Prospects". My CheckBox indicates if a person is a "Member". This code allows me to easily enter the names of "Members" or "Prospects" as needed in my ComboBox.