Printing a Variable Number of Reports

  • Thread starter Thread starter LMShaf
  • Start date Start date
L

LMShaf

Guest
I need to print tickets for an event. I have each reservation has an associated number of people with it, i.e. Mr. & Mrs. Joe Smith is one reservation for 2 people. This is one line item in my table. I need to print two tickets from this, each that say "Mr. & Mrs. Joe Smith." The number of people for each reservation is different.

I would like to be able to print all the tickets at once.

I have figured out how to print the same number of tickets for every reservation with the following code.

======
Option Explicit
Dim intPrintCounter As Integer
Dim int NumberRepeats As Integer

Private Sub Report_Open (Cancel As integer)
intPrintCounter = 1
intNumberRepeats = Forms!PrintForm!TimesToRepeat Record
End Sub

Private Sub Detail_Print(Cancel as Integer, PrintCount As Integer)

If intPrintCounter < intNumberRepeats Then
intPrintCounter = intPrintCounter + 1
Me.NextRecord = False
Else
intPrintCounter = 1
Me.NextRecord = True
End if
End Sub
=====

How do I change this so that for each record the variable "intNumberRepeats" changes? Or do you have any other suggestion on how to do this?

Thanks so much.
 
Write a query to return the desired records and the number of records. Use this as the rowsource for the report.

This will force the report to produce the same as your query. No code required, just ask the report to print with the docmd.openreport operation.
 
I dont understand what < is in the code if you could please clearify that it would help a great deal.
Also please advice on wether this would work on access2.0 as that is the version i am using


LMShaf said:
Private Sub Detail_Print(Cancel as Integer, PrintCount As Integer)

If intPrintCounter < intNumberRepeats Then
intPrintCounter = intPrintCounter + 1
Me.NextRecord = False
Else
intPrintCounter = 1
Me.NextRecord = True
End if
End Sub
=====
 

Users who are viewing this thread

Back
Top Bottom