Multiple Select list box info to a report

PMrider

Registered User.
Local time
Today, 20:15
Joined
Feb 22, 2002
Messages
11
Does anyone have a model on the use of ItemsSelected for list boxes. It will be greatly appreciated.
akolln@srt.com

thanks..
Alan
 
Not quite sure if this is what you're driving at. Assume a multi-select list box (which you want the bound column from) on a form and a command button which opens a report in preview mode. Here's one way:

Private Sub cmdPreview_Click()
Dim lst As ListBox
Dim vItem As Variant, sCriteria As String

sCriteria = ""

Set lst = Me.lstItems

For Each vItem In lst.ItemsSelected
sCriteria = sCriteria & "," & lst.ItemData(vItem)
Next vItem

DoCmd.OpenReport "reportname", acViewPreview, "ID IN (" & Mid(sCriteria, 2) & ")"
End Sub
 

Users who are viewing this thread

Back
Top Bottom