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

Multiple Reports

Status
Not open for further replies.

MrMeric

Technical User
Apr 1, 2004
48
US
Good day!

In the past, I have been tasked with printing multiple reports for each record within the database. In essence, I needed to collate the documents. To accomplish this I would use DAO/ADO and loop a "WHERE" statement to each report I wanted to print. The code would then move to the next record and repeat.

This proved to be a slow process, as it would need to create a new print job for every single record and report.

In the database I currently have, there are about 1,000 records. There are also 4 different reports. I would rather implement a collation option into the print process rather than having to manually collate 4,000 by hand.

Any ideas to make this process go faster? Is there any way you can make a report print without submitting a new job to the printer?

Thanks in advance!
 
MrMeric
If you want to print multiple copies of each record you have selected, here is a method.

1. Make a form with a text box in which you enter the number of times to repeat each record.
2. Have a command button that opens the report you wish to print.
3. In the report put the following code.

Code:
Option Compare Database
Option Explicit
Dim intPrintCounter As Integer
Dim intNumberRepeats As Integer

'This code goes on the OnPrint section of the report
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
   ' Note: intNumberRepeats and intPrintCounter are initialized
   ' in the report's OnOpen event.
   If intPrintCounter < intNumberRepeats Then
      intPrintCounter = intPrintCounter + 1
      ' Do not advance to the next record.
      Me.NextRecord = False
   Else
      ' Reset intPrintCounter and advance to next record.
      intPrintCounter = 1
      Me.NextRecord = True
   End If
End Sub

'this goes on the OnOpen event for the report
Private Sub Report_Open(Cancel As Integer)
   intPrintCounter = 1
   intNumberRepeats = Forms!PrintT5!TimesToRepeatRecord
End Sub

Hope that helps.

Tom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top