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!

Determine if report is PRINTED?!!

Status
Not open for further replies.

MrKaM

Programmer
Jan 10, 2003
3
EU
Please help me,
How can I determine that a report created by MS-Data report is Successfuly printed and then my application will check the report_info as a printed report so it could not be printed twice.
Thanx alot..
 


Even if the printed copy were to be successfully outputted from the printer, there is no guarentee that the print would always be legible (bad toner, crumpled paper, etc.). For that, you would need human intervention to read the printed report and verify that the whole process is successful.

The easiest way to implement would be you ask the user if the report was printed to satisfaction. If so, mark the report_info as a printed report, if not, reprint...etc

Mark
 
Of course, you have no way of knowing that a report actually printed, but you can monitor the progress of one or more printing processes. The DataReport's PrintReport automatically fires of a subprocess. That is why it returns a "cookie," i.e. a VB long integer that identifies the printing subprocess.

Each printing subprocess has three events that seem to be useful for your problem: ProcessingTimeout, ProcessingTimeout, and if needed, Error.

Private Sub object_ProcessingTimeout( _
Seconds As Long, _
Cancel As Boolean, _
JobType As AsyncTypeConstants, _
Cookie As Long)
This fires every second or so and gives you opportunity to cancel a job.

Private Sub object_AsyncProgress( _
JobType As AsyncTypeConstants, _
Cookie As Long, _
PageCompleted As Long, _
TotalPages As Long)
This event is fired with every new page shipped to the printer. In your stated case I would compare PageCompleted to TotalPages. When they are equal, you can mark the job as completed.

Private Sub object_Error( _
JobType As AsyncTypeConstants, _
Cookie As Long, _
ErrObj As RptError, _
ShowError As Boolean)

Look up "DataReport Object" in the MSDN October 21 library for more information. I also recomend Francesco Balena's "Programming Microsoft Visual Basic 6" very highly. He has a chapter on the DataReport Designer. In fact, if you can do it in VB, he covers it.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top