I added the code where I thought it should go... it is not working there. I am still seeing the apostrophe in the report title. Should the Replace code be on the textbox on the form or on the textbox in the report title.
txtlaborCat on the report has Control Source:[Forms]![frmPerfIssuesMain]![txtLaborCat]
Hope this helps.
Code:
Private Sub cmdPerfIssuesLaborCatRpt_Click()
On Error GoTo Err_cmdPerfIssuesLaborCatRpt_Click
Dim strWhere As String
Dim ctl As Control
Dim varItem As Variant
'make sure a selection has been made
If Me.lstLaborCatSelection.ItemsSelected.Count = 0 Then
MsgBox "Must select at least 1 employee"
Exit Sub
End If
'add selected values to string
Set ctl = Me.lstLaborCatSelection
For Each varItem In ctl.ItemsSelected
strWhere = strWhere & "'" & ctl.ItemData(varItem) & "',"
Next varItem
Debug.Print strWhere
'trim trailing comma
strWhere = Left(strWhere, Len(strWhere) - 1)
'open the report, restricted to the selected items
Me.txtLaborCat = strWhere
' replaces a single quote with empty string
strWhere = Replace(strWhere, "", "")
DoCmd.OpenReport "rptPerfIssuesbyLaborCat", acPreview, , "LaborCat IN (" & strWhere & ")"
Exit_cmdPerfIssuesLaborCatRpt_Click:
Exit Sub
Err_cmdPerfIssuesLaborCatRpt_Click:
MsgBox Err.Description
Resume Exit_cmdPerfIssuesLaborCatRpt_Click
End Sub