The following code should help you:
Private Sub cmdOpenReports_Click()
Dim varSelectedUPC As Variant
Dim lngUPC as Long
For Each varSelectedUPC In lstUPC.ItemsSelected
lngUPC = lstUPC.ItemData(varSelectedUPC)
Select Case lngUPC
Case 1111 to 3333
DoCmd.OpenReport "report1", acViewPreview, ,"UPC = " & lngUPC
'preview report; change to acViewormal to print immediately
Case 4444 to 6666
DoCmd.OpenReport "report2", acViewPreview, ,"UPC = " & lngUPC
Case Else
DoCmd.OpenReport "report3", acViewPreview, ,"UPC = " & lngUPC
End Select
Next varSelectedUPC
End Sub
This assumes that your list box is named lstUPC (multi-select, with UPC
being the bound column), that your reports have a recordset which includes
UPC (which is a number), and that you want a separate report
previewed/printed for each UPC (rather than a single report for all UPCs
within a range). You should probably add error checking/trapping to cope
with no data, or ... It's up to you where you take this.
BTW, a list box with over 500 items seems a little user-unfriendly ;-)
HTH,
Rob
> Hi Everyone,
>
[quoted text clipped - 10 lines]
> Thanks,
> Jess
Jessica - 15 Feb 2005 15:57 GMT
Thank you so much Rob I will try this when I get home tonight. I thought
that maybe what I wanted was asking too much but I guess not.
Thanks a million,
Jess
> The following code should help you:
>
[quoted text clipped - 44 lines]
>>Thanks,
>>Jess