Hi again Madpiet,
I think I all ready have that in my button code, see below!
However, the report is searching for the ID's and gives a parameter error if I select anything?
Suggestions?
Code:
Private Sub CmdReport_Click()
Dim varItem As Variant
Dim strDoc As String
If IsNull(Me.LstBusinessReport.Column(0)) Then
MsgBox "You must select a Report from Reprot List!"
Exit Sub
End If
On Error GoTo Err_Handler
With Me.LstBusinessReport
For Each varItem In .ItemsSelected
strDoc = .Column(1, varItem) 'assumes list box has two columns, the first one holding the reportID is the bound one and hidden
Next
End With
If Not IsNull(Me.LstIndustry.Column(0)) And IsNull(Me.LstCategory.Column(0)) And IsNull(Me.LstFunction.Column(0)) Then
DoCmd.OpenReport strDoc, acViewPreview, , "[BusinessPrimaryIndustryID] in(" & getLBX(Me.LstIndustry) & ")"
ElseIf Not IsNull(Me.LstIndustry.Column(0)) And Not IsNull(Me.LstCategory.Column(0)) And IsNull(Me.LstFunction.Column(0)) Then
DoCmd.OpenReport strDoc, acViewPreview, , "[BusinessPrimaryRoleID] in(" & getLBX(Me.LstCategory) & ")"
ElseIf Not IsNull(Me.LstIndustry.Column(0)) And Not IsNull(Me.LstCategory.Column(0)) And Not IsNull(Me.LstFunction.Column(0)) Then
DoCmd.OpenReport strDoc, acViewPreview, , "[BusinessPrimaryFunctionID] in(" & getLBX(Me.LstFunction) & ")"
Else
'DoCmd.OpenReport strDoc, acViewPreview
If Forms!frmBusiness.sfrmBusinessContact.Form.chkSingle = True Then
'MsgBox ("Hello")
DoCmd.OpenReport strDoc, acViewPreview, , "BusinessID=" & Forms!frmBusiness!BusinessID
Else
DoCmd.OpenReport strDoc, acViewPreview
End If
End If
Exit_Handler:
Exit Sub
Err_Handler:
If Err.Number <> 2501 Then 'Ignore "Report cancelled" error.
MsgBox "Error " & Err.Number & " - " & Err.Description, , "cmdPreview_Click"
End If
Resume Exit_Handler
End Sub