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!

.PrintReport Question

Status
Not open for further replies.

quiquous

IS-IT--Management
Jun 11, 2001
4
US
I'm using...

DataReport1.PrintReport False
DataReport1.PrintReport False
DataReport1.PrintReport False

to print 3 copies of a report without having to show it or the print dialog screen.

Is there a way to programatically modify the number of copies to print so that one PrintReport command could be used instead of three?
 
I'm new to VB, about 6 months, so don't laugh to hard if I'm wrong. I know you stated that you wanted it to print with little user interaction, but if the user will have to tell it how many copies anyway, why can't you make another form to come up with a ComboBox with 1 - 10, or more in the ListIndex and let the user select the number of copies. Use a Select Case statement to print the correct number of copies.

Dim Quantity as Integer
Quantity = ComboBox.Text
Select Case "Quantity"
Case 1
DataReport.PrintReport False
Case 2
DataReport.PrintReport False
DataReport.PrintReport False
Case 3
DataReport.PrintReport False
DataReport.PrintReport False
DataReport.PrintReport False

'etc.

Like I said, I'm a newbie so don't laugh. I'm sure there is probably a better way.
Every day above ground is a GOOD DAY!!!
 
Reread the question again, sorry, I missed the point. I don't know how to increase the number of copies without doing what you did. Every day above ground is a GOOD DAY!!!
 
You can't define the number of copies to print with the PrintReport method(at least I'm not aware of that), but you really don't need to...

Just make a loop to print the number of times you want, like:

Quantity= 'get from the user

For i=1 to Quantity
DataReport1.PrintReport False
Next i

 
Code:
Dim i As Integer, Copies As Integer
Copies = InputBox("Copies :", , 3)
For i = 1 To Copies
  DataReport1.PrintReport False
Next[\code]

Hope this is what you meant.
Sfenx
 
Or you can allow the user to select the number or reports at runtime using

datareport1.printreport true

and letting them print from the print dialog box which includes copies.


Pete
_____________
Real programs don't eat cache


 
Thanks for the suggestions everyone...but most of what you said I've already tried.

Yes, I can ask the user for the number of copies to print, and issue x number of PrintReport commands, but it would be more shnazzy to set the number of copies, as one does with the print dialog screen, and use one command to print.

When using more than one PrintReport command, the user sees more than one "Now Printing" windows that pop up briefly. So, for my example of using three statements to print three copies, there are three flashes of windows popping up in front of the user. It not only takes time to do this, it also looks a bit tacky.

Maybe there's another way of printing the reports NOT using the PrintReport method?
 
Have you considered using crystal reports for your report? You can easily set the number of copies printed using the copiestoprinter property.

Just a thought

Pete
_____________
Real programs don't eat cache


 
I haven't considered it until now. Problem is, I've already got lots of DataReports made and porting them over to Crystal may take too much time.

I'm hoping someone has some insight on how to set the number of copies to print. It seems like such an easy thing to do...keyword "seems".
 
Hi! I'm trying to do the same, to print two copies of a datareport but it only prints one copy i don't know why.

report.PrintReport
report.PrintReport

Only prints the first one on a remote printer, if I run this in a local printer it works but on a remote printer doesn't.
Only if I put a msgbox before printing the second copy it works but I need to be printed without any click by the user.
I appreciate some suggestion!
thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top