I have a combobox on my main form that the user selects the employee and the the subform displays the results in a datasheet view. The code is below. I'd like to add 2 check boxes as additional criteria the user can search with. First checkbox will be "Open Tasks" and the 2nd checkbox would be "Closed Tasks". By default i'd like both checkboxes selected.
My checkbox names:
Open Tasks checkbox name: chkOpen
My checkbox names:
Open Tasks checkbox name: chkOpen
Closed Tasks checkbox name: chkClosed
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