multi-select filters report

  • Thread starter Thread starter r
  • Start date Start date
R

r

Can someone point me to a good article or tutorial on how this works?

I have a listbox on a "menu" like form. The user can select one or many
names in the list, then click a button which will open a report displaying
the details for only the IDs selected in the listbox.

And for that matter, I'd like to make a "select all" and "unselect all"
button since I've got a bazillion entries in the list. A pointer for that
would be great, too, if there is one.

Thanks again.
 
Loop through the ItemsSelected collection of the unbound multi-select list
box, to build up the WhereCondition of the OpenReport.

Details and example code in this article:
Use a multi-select list box to filter a report
at:
http://allenbrowne.com/ser-50.html
If no items are selected, the WhereCondition will be blank, and so all items
will be shown in the report.

The code below clears all selections in the list box:

Function ClearList(lst As ListBox) As Boolean
On Error GoTo Err_ClearList
'Purpose: Unselect all items in the listbox.
'Return: True if successful
Dim varItem As Variant

If lst.MultiSelect = 0 Then
lst = Null
Else
For Each varItem In lst.ItemsSelected
lst.Selected(varItem) = False
Next

End If

ClearList = True

Exit_ClearList:
Exit Function

Err_ClearList:
MsgBox "Error " & Err.Number & " - " & Err.Description
Resume Exit_ClearList
End Function
 
Back
Top