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

PRINT ALL reports from a dialog? 2

Status
Not open for further replies.

MFFL

Vendor
Nov 20, 2002
26
US

For instance want to print say baseball batting averages report. Dialog pops up with listbox to select which team's roster i want to print.

now is there a way to create a button that prints the batting averages reports of all the teams in that dialog box?

need guidance

any help much appreciated. MMFL-
Mavericks Fan For Life
 
If the reports are all similar, consolidate the reports to one report and have the opening dialog box simply create the filter statement for the report based on the team selected on the report. Add a "View All Teams" selection to the dialog box and have it print the report without any filters. I think that will do the trick for ya.
 
Sticking with the baseball analogy.

AccessAce consolidating the reports into one is not an option.

I need to be able to print 28 seperate reports with team headings on each report. With only the batting averages of such and such team on such and such report.

You understand my dilema now. Currently the user is having to select each report to print it, although when they print one they are generally going to print all of em, but not always.

Thanks for quick response. Open to suggestions still if Anyone has some. MMFL-
Mavericks Fan For Life
 
Here's a thought. Add a line in the combo box for print all reports. If that option is selected, then, rather than simply print a report, call a routine that will print every report in that box.

If cboBox.Value <> &quot;Print All Reports&quot; Then
strRptName = cboBox.Value 'Set the report name
docmd.OpenReport strRptName 'Print the report
Else
Call PrintAllReports 'Call routine to print all reports
End If

Private Sub PrinAllReports()
Dim strRpt ast String
Dim i as Integer

'loop through the combo box and print each report

End Sub
 
What you need is to multi select from the list box. Set the Multi Select property to Simple. Then add this code to a command button.

On Error GoTo Err_Print_ClickErr

Dim vntIndex As Variant
Dim strValue As String

'Check to see if selection has been made.

If lstListBoxName.ListIndex < 0 Then
MsgBox &quot;Please select 1 or more items from the list&quot;
Exit Sub
End If

'Print selection

For Each vntIndex In lstListBoxName.ItemsSelected
strValue = lstListBoxName.ItemData(vntIndex)
DoCmd.OpenReport strValue, acViewNormal
Next
'Error handling

Err_Print_ClickErr:
Select Case Err.number
Case 2501 'cancelled by user or no data for the report
MsgBox &quot;Report cancelled or no data found for the report.&quot;, vbInformation, &quot;Information&quot;
' Case Else
' MsgBox &quot;Error &quot; & Err & &quot;: &quot; & Error$, vbInformation, &quot;Print_Click()&quot;
End Select


End Sub
 
You've gotten responses here, both of which would work. Yet you've posted in another forum asking for help and not supplying any more info. Do some of the work yourself and then come back with the results. Don't expect us to roll up a solution, put a bow on it, and give it to you for the holidays.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developers' section of the site for some helpful fundamentals.
 
AccessAce, DJN thankyou for your guidance. I gave you both stars.

JeremyNYC, get off your highhorse. while i have not given a lot of advice in access forums i have in other forums here. I also, because I do depend on help here, make donations (financial) to this forum. I also award stars.

Reason I posted this in another forum was to reach wider audience. Note I posted it after the weekend and with a link to this forum so people read what myself and AccessAce had previously posted.

I also posted a FAQ here, potentially saving people money on AccessRecovery software.

Merry Christmas. MMFL-
Mavericks Fan For Life
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top