using mulltiple criteria in strfilter

May 10, 2011
Reaction score
Below is code that someone so generously wrote for me. It generates a report based on the selection(s) from a listbox.

I need to add a second filter. The report is based on a table called tblRecruitment, which contains a checkbox field called PrintRecruitment. The second criteria I want to add to the strfilter would be something like [PrintRecruitment] = True. I'm unsure of the exact syntax and where to place it in the code below.

Any help is appreciated.

Private Sub lblPrintCurrentRecruitments_Click()
On Error GoTo Err_blPrintCurrentRecruitments_Click
    Dim varItem As Variant
    Dim strFilter As String
    If Me.lstSpecialist.ItemsSelected.Count = 0 Then
           MsgBox "Please select a Specialist.", vbOKOnly + vbExclamation, "Select a Specialist"
        For Each varItem In Me.lstSpecialist.ItemsSelected
            strFilter = strFilter & Chr(34) & Me.lstSpecialist.ItemData(varItem) & Chr(34) & ","
        If Right(strFilter, 1) = "," Then
           strFilter = Left(strFilter, Len(strFilter) - 1)
        End If
         strFilter = "[Specialist] In(" & strFilter & ")"
        DoCmd.OpenReport "rptRecruitReclassCombined", acViewPreview, , strFilter
    End If
    Exit Sub
    MsgBox Err.Description
    Resume Exit_blPrintCurrentRecruitments_Click
End Sub

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question