I have a search form and a subform underneath in datasheet view. On the search form i currently have a combobox where the user can select a name and press the search button (code below) and it gives the results for the name they selected. That part works fine. However I want to add 2 checkboxes to the main form that will filter on a field named "Status" The checkboxes will be named "Filter for Open" and "Filter for Closed". By Default both checkboxes will be checked so if the user only wants to filter for one they would need to unselect whichever checkbox they don't want to see.
I'm just not sure how to add the 2 checkboxes to my code below.
I'm just not sure how to add the 2 checkboxes to my code below.
C++:
Private Sub cbo_Search_Click()
Dim Varitem As Variant
Dim strEmployee As String
Dim strSQL As String
' Gets what Employee has been selected
For Each Varitem In Me!cbo_Employee.ItemsSelected
strEmployee = strEmployee & ",'" & Me!cbo_Employee.ItemData(Varitem) & "'"
Next
strSQL = "SELECT * FROM Tasks WHERE "
strSQL = strSQL & "Tasks.[Assigned To] = '" & cbo_Employee & "' "
Me.[Tasks subform].Form.RecordSource = strSQL
End Sub