Printing Reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like for a command button on a form to print 2 copies of a report. I
have figured out a way but it seems like "sloppy" programming. I have
repeated the command twice:

Dim stDocName As String

stDocName = "Student Suspension"
DoCmd.OpenReport stDocName, acNormal
DoCmd.OpenReport stDocName, acNormal

Is there a better way or is this acceptable in programming?
 
hi,
stDocName = "Student Suspension"
DoCmd.OpenReport stDocName, acNormal
DoCmd.PrintOut , , , , 2

If you had a text box on your form called txtQtytoPrint
you could enter the quantity to print in that and print
out the number of copies that you entered into the text
box.

stDocName = "Student Suspension"
DoCmd.OpenReport stDocName, acNormal
DoCmd.PrintOut , , , , Me.txtQtyToPrint

regards
 
I tried this and it printed the report and the form I have the command button
on. The stDocName refers to a report that runs. What I want to do is have
the report printed twice (since we don't have a carbonless form) and not
print the form itself. I didn't want to click twice and I thought the
copying of the code twice was not the best way to program. It works, I was
just trying to find the right way to do it.
 
You can ask the user how many copies to print and then use a For...Next loop:

strCopies = Inputbox("How many copies?", "Copies?", 2)
If strCopies <> "" Then intCopies = strCopies
For intX = 1 to intCopies
DoCmd.OpenReport stDocName, acNormal
Next intX
End If
 
Back
Top