Dim strWhere As String
Dim ctl As Control
Dim varItem As Variant
Dim strWhereCo As String
Dim strWhereContact As String
'make sure a selection has been made
If Me.lstLeft.ItemsSelected.Count = 0 Then
MsgBox "Must select at least 1 Company"
Exit Sub
End If
'add selected values to string
Set ctl = Me.lstLeft
For Each varItem In ctl.ItemsSelected
strWhereCo = strWhereCo & ctl.Column(3, varItem) & ","
strWhereContact = strWhereContact & ctl.Column(4, varItem) & ","
Next varItem
'trim trailing comma
strWhereCo = Left(strWhereCo, Len(strWhereCo) - 1)
strWhereContact = Left(strWhereContact, Len(strWhereContact) - 1)
'open the report, restricted to the selected items
strWhere = "CompanyRef IN(" & strWhereCo & ") AND ContactRef IN(" & strWhereContact & ") AND GroupCode = " & Me.lstGroup
Debug.Print strWhere
DoCmd.OpenReport "rtGroupCo", acPreview, , strWhere