Fusseltier
August 19th, 2004, 08:57 AM
Hi everybody,
I'm having problems printing several reports after another, e.g. printing from a Loop...
My Code looks like this:
Dim newrep_b as new crep_order_xxx
For i = 0 To rssammel.Recordcount
On Error GoTo 0
newrep_b.ordereinzel = 1
newrep_b.bebrals_id = lsarray(i)
newrep_b.Hide
newrep_b.Report.SelectPrinter "TallyT8004", "", ""
newrep_b.Report.PrintOut (False)
Unload newrep_b
Set newrep_b = Nothing
Next
Lets say I have 5 Records in rssammel....
The First Report gets printed, the second too, but the third one and all reports after are NOT printed....
"PrintOut" raises the error: "Run Time Error '-2147417848': Method 'PrintOut' of object 'crep_order_xxx' failed"
And now the REALLY strange thing....
If I put breakpoints into my code (on the PrintOut - Line), and step through the Loop "by hand" (using F8 in VB-IDE), everything works like a charm...
Without the breakpoint I get the error from above, but the first 2 Reports are getting printed fine...
Does anybody have an idea why CR / VB raises that error ? Is it some kind of timing-problem, or perhaps the Print-Spooler is getting filled too fast ??
Greetings and many thanks for your help in advance !
Fusseltier
I'm having problems printing several reports after another, e.g. printing from a Loop...
My Code looks like this:
Dim newrep_b as new crep_order_xxx
For i = 0 To rssammel.Recordcount
On Error GoTo 0
newrep_b.ordereinzel = 1
newrep_b.bebrals_id = lsarray(i)
newrep_b.Hide
newrep_b.Report.SelectPrinter "TallyT8004", "", ""
newrep_b.Report.PrintOut (False)
Unload newrep_b
Set newrep_b = Nothing
Next
Lets say I have 5 Records in rssammel....
The First Report gets printed, the second too, but the third one and all reports after are NOT printed....
"PrintOut" raises the error: "Run Time Error '-2147417848': Method 'PrintOut' of object 'crep_order_xxx' failed"
And now the REALLY strange thing....
If I put breakpoints into my code (on the PrintOut - Line), and step through the Loop "by hand" (using F8 in VB-IDE), everything works like a charm...
Without the breakpoint I get the error from above, but the first 2 Reports are getting printed fine...
Does anybody have an idea why CR / VB raises that error ? Is it some kind of timing-problem, or perhaps the Print-Spooler is getting filled too fast ??
Greetings and many thanks for your help in advance !
Fusseltier