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

How to print a number of reports 2

Status
Not open for further replies.

srast

MIS
Nov 11, 2002
42
US
Hi all,
I would like to have a textbox on a form where the user can enter the number of reports to print. I have a button which prints the report, created by the wizard, which has the following code:
Dim stDocName As String
stDocName = "PickTticket"
DoCmd.OpenReport stDocName, acNormal
How can I set the number of reports to print?
Thanks.
Steve
 
Are you looking to print more than one copy of the same report or to print one copy each of some different reports?
 
Tow options.....Both involve adding the text box to the form. Name the textbox Copies...

Option one is to use the DoCmd.PrintOut command...

Then change code to:

Dim stDocName As String
stDocName = "PickTticket"
DoCmd.OpenReport stDocName, acPreview
DoCmd.PrintOut acPrintAll, , , , Me![Copies]
DoCmd.Close acReport, stDocName

Option two involves a loop...

Change code to:

Dim stDocName As String
Dim i As Integer
stDocName = "PickTticket"
For i = Me![Copies] To 0 Step -1
DoCmd.OpenReport stDocName, acNormal
Next i

Option two actually causes the report to open and close with each print....option one is the better method.
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III, MCP, Network+, A+
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
thanks RJ i found your post useful as well MMFL-
Mavericks Fan For Life
 
mstrmage1768:

Thanks for your reply. Your code is just what I'm looking for. I really appreciate it!
(I gave your reply a star.)

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top