Newbie in need of assistance, here!
I have a Subform named frmOverview subform based in a Form named frmOverview. The datasheet view of the subform is as attached:
In frmOverview, I have two combo boxes - Combo20 is used to filter the subform by Area and Combo22 is used to filter the subform by Discipline.
The problem I have is linking the combo boxes together so that, when both are utilised, the correct row(s) are shown in the subform. At the moment, if I select "North" in Combo20, only the rows containing North appear in the subform but, if I then select "Animals" in Combo22, I would like to see just the one row that contains both these values. However, I see all rows that contain "Animals" as a value, regardless of whatever Area is selected in Combo20.
My code is currently like this:
Private Sub Combo20_Change()
Me.Combo22.Requery
Me.Combo22 = ""
Me.Combo22.Visible = True
Me.[frmOverview subform].Form.FilterOn = True
Me.[frmOverview subform].Form.Filter = "Area= '" & Me.Combo20 & "'"
End Sub
Private Sub Combo22_Change()
Me.[frmOverview subform].Form.FilterOn = True
Me.[frmOverview subform].Form.Filter = "Discipline= '" & Me.Combo22 & "'"
End Sub
Could a kind person out there modify the code for me before I tear any more hair out? I really don't want to look like Karl Pilkngton.
Many thanks!
I have a Subform named frmOverview subform based in a Form named frmOverview. The datasheet view of the subform is as attached:
In frmOverview, I have two combo boxes - Combo20 is used to filter the subform by Area and Combo22 is used to filter the subform by Discipline.
The problem I have is linking the combo boxes together so that, when both are utilised, the correct row(s) are shown in the subform. At the moment, if I select "North" in Combo20, only the rows containing North appear in the subform but, if I then select "Animals" in Combo22, I would like to see just the one row that contains both these values. However, I see all rows that contain "Animals" as a value, regardless of whatever Area is selected in Combo20.
My code is currently like this:
Private Sub Combo20_Change()
Me.Combo22.Requery
Me.Combo22 = ""
Me.Combo22.Visible = True
Me.[frmOverview subform].Form.FilterOn = True
Me.[frmOverview subform].Form.Filter = "Area= '" & Me.Combo20 & "'"
End Sub
Private Sub Combo22_Change()
Me.[frmOverview subform].Form.FilterOn = True
Me.[frmOverview subform].Form.Filter = "Discipline= '" & Me.Combo22 & "'"
End Sub
Could a kind person out there modify the code for me before I tear any more hair out? I really don't want to look like Karl Pilkngton.
Many thanks!