Help with Multi Select List Box

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

Hi All,

I have a multi-select list box for print reports.


I am using the following code to print the reports. The Column1 is the report
name.

However when I select more then one report in my list box it only print the
last in the list. How would I change my code to allow me to print all that
are selected?


If Not IsNull(Me.lbMultiSelectListbox__.Column(1)) Then
DoCmd.OpenReport Me.lbMultiSelectListbox__.Column(1), , ,
acViewNormal
End If

Thanks
Matt
 
C

Carl Rapson

You need to iterate through all selected items in the list box:

Dim vnt as Variant
For Each vnt In lbMultiSelectListbox__.ItemsSelected
DoCmd.OpenReport lbMultiSelectListbox__.Column(1, vnt),,,acViewNormal
Next vnt

HTH,

Carl Rapson
 
M

mattc66 via AccessMonster.com

Thank you that worked great..

Carl said:
You need to iterate through all selected items in the list box:

Dim vnt as Variant
For Each vnt In lbMultiSelectListbox__.ItemsSelected
DoCmd.OpenReport lbMultiSelectListbox__.Column(1, vnt),,,acViewNormal
Next vnt

HTH,

Carl Rapson
[quoted text clipped - 16 lines]
Thanks
Matt
 

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