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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Humdinger; Print Report from ListBox Index

Status
Not open for further replies.
May 5, 2000
168
US
I've created two list boxes so the user can pick from the first to populate the second. The user can also change the order of the records in the second list box.

From the second list box a report will be printed. I want the report to print in the order of the list.

I've created a recordset based on the list. Now I need to tell the report to print on the recordset.

How do I tell the report to look at the recordset for its recordsource?
 
Where have you created the recordset? I think that it might work better if you used the values in the second listbox as criteria for a query and based your report on the query.

When you do whatever you do to kick off the report, don't close the form, just hide it. Then you can access the values from the form using the Forms!YourFormName!YourControlName syntax.

Does that sound like a viable alternative? Kathryn


 
Jane -
Kathryn is right, you should use the second list box. I'm assuming the second list box contains the report names and allows Multiple selections. Try this code:

Dim varItem as Variant

If List2.ItemsSelected.Count > 0 Then
For each varItem in List2.ItemsSelected
DoCmd.OpenReport Reports(List2.ItemData(varItem))
Next varItem
End If

Hope this works - Shane
 
I've made something simmilar to this form of you. I use a hidden textbox in that form to construct a SQL string and then, when I open the report I refer to this textbox to set the RecordSource property. I can show you haow if this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top