I'm trying to use cascading comboboxes to filter data. The user will use the boxes to choose a project to run a report.
I have a combobox (cboState) that queries all the distinct states from a related table. Once the user makes a selection there it should filter the second combobox to only contain projects in that state. In the example below, I've selected Alabama in cboState. This project, however, only covers one state which is Louisiana. How do I need to format my query to return one record if the value of cboState is included in the related State table
Just to clarify the cascading combobox portion works fine. I have another value (filter by region) which is in the project table as opposed to a related table. When I make a selection in that box, the project combobox is properly filtered.
Here's the code on for the after update event on cboState
Code:
Private Sub cboState_AfterUpdate()
cboProject.RowSource = "SELECT Project.ProjectID, Project.ProjectTitle, Project.FWSregion, State.State " & _
"FROM Project, State " & _
"WHERE State.State = '" & cboState & "'; "
cboProject = Null
Debug.Print cboProject.RowSource
End Sub