Using multi selection list boxes for reports
Posted on 2001-09-17
On a form used for inputting info for a report I have 2 multi selection list boxes which I want to pass to a report.. I eventually figured out how to do it for one but I need know to be able to do it for 2 or more. The following code is what I ended up with but when you you select from the 2 lists it takes both criteria and prints as if you were running 2 seperate queries and combining the results. I think its combining the 2 criteria as "OR" rather than "AND"
Private Function GetCriteriaRS() As String
Dim stDocCriteria As String
Dim VarItm As Variant
For Each VarItm In lstCompanies.ItemsSelected
stDocCriteria = stDocCriteria & "[Supplier] = " & lstCompanies.Column(0, VarItm) & " OR "
For Each VarItm In List169.ItemsSelected
stDocCriteria = stDocCriteria & "[Point] = '" & List169.Column(0, VarItm) & "'" & " OR "
If stDocCriteria <> "" Then
stDocCriteria = left(stDocCriteria, Len(stDocCriteria) - 4)
stDocCriteria = "True"
GetCriteriaRS = stDocCriteria
Any suggestions would be greatfully recieved