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!

reports in a list box - urgent

Status
Not open for further replies.

mrathi

Technical User
Oct 27, 2003
115
US
Hello,
Thanks for any help. I have a list box in a form. The items in the list are derieved from a query. The items can change depending on the information. I want to create a button that will print all the reports based on the items in the list. I have already created a button to click the items in the list and print individual reports.

Duane said:

If you want to open multiple reports with each filtered based on the value of a list box, then consider:
Dim strWhere as String
strWhere = "[ItemID]=" & Me.lboItemID
DoCmd.OpenReport "rptA", , ,strWhere
DoCmd.OpenReport "rptB", , ,strWhere
DoCmd.OpenReport "rptC", , ,strWhere
'etc

My concern:Thanks for the reply. I am quite a newbie here. I assume [ItemD] stands for the list index. If so, my concern is that since the list will vary everytime, so will the list indexes. In that case rptA will print no matter if it is in the list or not.
 
Every list box has a bound column. This determines the value of list box. When a user makes a selection in a list box, the value of the list box is dependent on the bound column of the selected item in the list. Since you didn't provide a field name, list box name, report name(s), or whatever, I substituted generic names.

If you need more detailed answers, you will need to provide more specific information. It isn't clear if the list box is multiselect or not. Also, does the list box contain a value that is common to all the reports?

Duane
MS Access MVP
 
thanks
The list box lists all the reports available based on the information provided. Now, the user can click individual reports and print them. However, I wanted a command button to just print all the reports in the list box at one time. The list box is not multiple select. The list of the reports in the list box varies. For example, I have a total of 20 reports. If the person fills in all the information, he/she will have 20 reports in the list box. If they omit, any information, they might have fewer reports in the list box.
 
It wasn't clear what was in the listbox. If these are report names and you want to run all of them, you will need to loop through the items.
Private Sub cmdRunReports_Click()
Dim i As Integer
For i = 0 To Me.lboReports.ListCount - 1
DoCmd.OpenReport Me.lboReports.ItemData(i)
Next
End Sub

Duane
MS Access MVP
 
Hello
I have a similar item i am working on.
I have a multiselect list box with gives the name of fields that have paragraph information on them. I would like the user to select these 'paragraph names' and then print a report based on these selections.

The trick is that the names do not all display at the same time they are shown with the choosen item from another listbox.

Heres the breakdown
Listbox 1
Heading 1
Heading 2
Heading 3

LIst box 2 (shows subheading for each heading choosen)
ie when Heading 1 is choosen
SUb 1
SUb 2
Sub 3
Heading 2
SUb 1
Sub 2
and so on.

From this the user chooses a subheading to see the choice of paragraph name and then can choose another subheading and choose another paragraph name?

Any suggestions.
VIshal
 
I can't follow this. What is your question? What part of this isn't working?

Duane
MS Access MVP
 
i'm not sure how to make the list keep the choosen report from one subheading and include it to the choice from another subheading
Vishal
 
Since you "tacked on" to this thread, I suggest you start a new thread with a more clear explaination. Maybe someone else will understand better. I turned "grandpa" on Tuesday and my ability to comprehend just past into an older generation.

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top