MultiSelect Print Preview help

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!!
 
R

Rick Brandt

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.
 

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