multiple selection in list box

M

Michael

Hi,

I need to create a list box where the user can select
multiple rows, and then click a "Filter" button. A form
containing the records that were selected in the list box
should appear. Any help would be greatly appreciated!

Michael
 
K

Ken Snell

Something like this, perhaps:

Dim strFilter As String
Dim lngLoop As Long
strFilter = ""
For lngLoop = 0 - ListBoxName.ColumnHeads To lstBoxName.ListCount - 1
If ListBoxName.Selected(lngLoop) = True Then _
strRptFilter = strRptFilter & "FieldName=" & _
ListBoxName.ItemData(lngLoop) & " Or "
Next lngLoop
If Len(strRptFilter) > 4 Then strRptFilter = Left(strRptFilter,
Len(strRptFilter) - 4)
DoCmd.OpenForm "formname", , , strRptFilter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top