Originally Posted by
DAWNY2007
The file is zipped. Has to be unzipped. There are definitely tables, etc in the file. I had to zip it, otherwise I could not attach
There is definitely not tables etc in the file I downloaded and unzipped... only 4 forms.
Anyway, here is a starting point
Code:
Private Sub MasterCustomerReport_Click()
Dim criteria As String
Dim i As Integer
'loop through listbox and build a filter string
With Me.MasterCustomerSelect
For i = 0 To .ListCount - 1
If .Selected(i) Then
criteria = criteria & """" & .ItemData(i) & """, "
End If
Next i
End With
'check the criteria we built
If criteria <> "" Then
'remove the trailing ', ' from the filter string
criteria = Left(criteria, Len(criteria) - 2)
Else
'it appears nothing was selected
MsgBox "Please select one or more customers"
Exit Sub
End If
'Debug.Print criteria
DoCmd.OpenReport "Master Customer Report", , , "[SOME FIELD NAME] IN (" & criteria & ")"
End Sub
[edit]
ok nvm, they were hidden from navigation. My mistake
Replace [SOME FIELD NAME] with [MASTER CUSTOMER] in my code above and remove the criteria from the base query.
Code:
DoCmd.OpenReport "Master Customer Report", , , "[SOME FIELD NAME] IN (" & criteria & ")"
Should be
Code:
DoCmd.OpenReport "Master Customer Report", acViewPreview, , "[MASTER CUSTOMER] IN (" & criteria & ")"