MultiSelect Print Preview help

  • Thread starter Thread starter JP
  • Start date Start date
J

JP

I'm trying to get a MultiSelect list box to Print Preview
the selected records in the listbox. This is what I have
so far:

Dim stDocName As String
stDocName = "Report"

DoCmd.OpenReport stDocName, acPreview , , " ID = " & Me!
listboxname.Column(0)

The only problem is I get Print Preview for the first
selection, not multiple selections. Any help would be
greatly appreciated!!
 
JP said:
I'm trying to get a MultiSelect list box to Print Preview
the selected records in the listbox. This is what I have
so far:

Dim stDocName As String
stDocName = "Report"

DoCmd.OpenReport stDocName, acPreview , , " ID = " & Me!
listboxname.Column(0)

The only problem is I get Print Preview for the first
selection, not multiple selections. Any help would be
greatly appreciated!!

A Multi-Select ListBox has no value. You have to loop through the ItemsSelected
collection to grab all of the rows that are currently highlighted and then your code
has to "do something" with the values in those rows. In your case you would need to
build up a string that was a comma separated list of all of the Column(0) values in
the selected rows and then use that for an In() clause for your criteria.
 
Back
Top