Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple select list box?

Status
Not open for further replies.

mrathi

Technical User
Oct 27, 2003
115
US
Hello:
Currently I have a list box, that lists some of the report names in the list based on the forms filled. Now, I have a single selction, so when the user selects a report from the list box and click Print button, that particular report will print.
I was wondering, if I can give the user multiple selections in the list box? Can the user select multiple reports in the list box and hit Print button, to print all the seleted reports?
Any help is always appreciated.
Thanks
 
Hi

Basically - yes

you change the list box type to be multi select, then you loop through the selected items (reportnames ?) executing each report, in 'air' code

For each Selected Item
doCmd.OpenReport ...,SelectedItem
Next

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
I used the follwoing code:
Dim X As Variant
For Each X In List1.ItemsSelected
DoCmd.OpenReport "MrptEUMiscellaneous", acViewPreview, , "EmissionUnitId = '" & List1 & "'"
Next

However, it gives the error message of no data for the report. Please help.

Thanks
 
Hi

Have you tried

For Each X In List1.ItemsSelected
DoCmd.OpenReport "MrptEUMiscellaneous", acViewPreview, , "EmissionUnitId = '" & X & "'"
Next

If you think about it, it cannot be List1, becuase it must be 'n' values and List1 does not change in the loop, but X does


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top