using mulltiple criteria in strfilter

Joined
May 10, 2011
Messages
1
Reaction score
0
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.

Code:
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"
    Else
        For Each varItem In Me.lstSpecialist.ItemsSelected
            strFilter = strFilter & Chr(34) & Me.lstSpecialist.ItemData(varItem) & Chr(34) & ","
        Next
 
        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_blPrintCurrentRecruitments_Click:
    Exit Sub
Err_blPrintCurrentRecruitments_Click:
    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

Top