Crystal Reports, How to get an event when it's done printing ?
I need to know when the report is done printing, right now i'm using this code:
VB Code:
Dim application As CRAXDRT.application
Dim Report As CRAXDDRT.Report
Dim ReportFileName As String
Dim ReportName As String
Set application = New CRAXDRT.application
ReportFileName = gblAppPath & "Reports\Label.rpt"
Set Report = application.OpenReport(ReportFileName)
Report.PrintOut (False)
' ** WAIT UNTIL REPORT IS DONE PRINTING ***
Set Report = Nothing
Set application = Nothing
' Some other code here...
Another question:
How do I know what was printer and what not, in case the printing was cancelled ?
Re: Crystal Reports, How to get an event when it's done printing ?
Know how?
Since your code probably won't hit the code where you are setting your report to Nothing until it has finished, then I would suggest putting a label on your form and, immediately after those lines place some text in its caption to indicate the job is done.
This is of course would work nicely if you are sitting at your desk waiting for the report to finish. If not, then some other form of notication would be required (hence my first question), but either way, if you put something after those lines of code, it should do what you want.
Re: Crystal Reports, How to get an event when it's done printing ?
Ups, I just spoted a mistake in my second question, it should be:
How do I know what was printed and what not, in case the printing was cancelled ?
For example if crystal reports prints like 1000 documents, and it was interrupted somewhere in the middle, how do I know where was interrupted from code ?
And about the waiting problem: I want to display a message "Please wait while printing..." and maybe with a progress bar (if possible), and when it's done printing I want to execute another code (mark the records as printed).
Quote:
Originally Posted by Hack
Since your code probably won't hit the code where you are setting your report to Nothing until it has finished.
You mean that this line:
hangs the program until the printing is done ?
I don't think so... I think it goes directly to the "Set Report = Nothing" lines and crystal report continues to print even after that.
Searching on google i found this, but I did not have time to try it yet:
http://72.14.205.104/search?q=cache:...a&ct=clnk&cd=4
If you go to the bottom of the page you will see some code where it looks like it's waiting until the printing status is complete.
I'm gonna try that code soon...
Re: Crystal Reports, How to get an event when it's done printing ?
Quote:
Originally Posted by CVMichael
Actually no, I meant these lines
VB Code:
Set Report = Nothing
Set application = Nothing