Results 1 to 4 of 4

Thread: Crystal Reports, How to get an event when it's done printing ?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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:
    1. Dim application As CRAXDRT.application
    2.  Dim Report As CRAXDDRT.Report
    3.  Dim ReportFileName As String
    4.  Dim ReportName As String
    5.  
    6.  Set application = New CRAXDRT.application
    7.  
    8.  ReportFileName = gblAppPath & "Reports\Label.rpt"
    9.  Set Report = application.OpenReport(ReportFileName)
    10.  Report.PrintOut (False)
    11.  
    12.  ' ** WAIT UNTIL REPORT IS DONE PRINTING ***
    13.  
    14.  Set Report = Nothing
    15.  Set application = Nothing
    16.  
    17.  ' Some other code here...

    Another question:
    How do I know what was printer and what not, in case the printing was cancelled ?
    Last edited by CVMichael; Jan 24th, 2007 at 09:01 AM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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:
    VB Code:
    1. Report.PrintOut (False)
    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...

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Crystal Reports, How to get an event when it's done printing ?

    Quote Originally Posted by CVMichael
    You mean that this line:
    VB Code:
    1. Report.PrintOut (False)
    Actually no, I meant these lines
    VB Code:
    1. Set Report = Nothing
    2.  Set application = Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width