Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

AfterPrint

edited August 2004 in General
My problem is the folow:

i can?t capture the 'After Print' event, because when printing in other
units i call the ppReport1, wich is located at the main form.


I writed some code at the 'After Print' event, and then debugging the
compiler don?t enter this event after i send the report to the printer.

any help?

Marcelo

Comments

  • edited August 2004
    Hi Marcelo,


    If you have access to the report object, then you should be able to assign
    the AfterPrint event. Are you by chance loading a template? If so, you may
    be loosing your references to the event handler.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2004
    yes, i am loading a report from the report explorer in run-time, and
    then printing it.

    Show i write the code inside the RAP?

    If i do that, can i write a sql code there to update a field in the
    database?


  • edited August 2004
    Hi Marcelo,

    I'm unclear about what you are trying to accomplish. If you are loading
    templates, then that is definitely the reason your AfterPrint event is not
    firing. As a rule of thumb, you should never alter the data while a report
    is generating. Which data are you trying to change and how are you changing
    it? If you need to populate a dataset based on report calculations, you
    could possibly make these calculations outside the report and update the
    dataset completely separate from ReportBuilder.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2004
    Let me explain.

    I have orders beeing printed, and i want to update a field in the orders
    table, wich one stores the date when the order was first printed out to he
    paper.

    I load the template, the user send the order to the printer, i capture
    this event and set the field in the orders table with the actual date.


    Marcelo




  • edited August 2004
    Hi Marcelo,

    This would definitely be possible using a RAP pass thru function. In the
    AfterPrint event in RAP, simply call the pass thru function to update your
    dataset with the actual date.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2004
    i don?t know how to use it... Could u explain or give a example?

  • edited August 2004
    Hi Marcelo,

    Since there is no way to access outside objects in RAP you will need to
    create a pass thru function in delphi that is registered and called from RAP
    to do so. There is an example of creating a pass thru function located in
    the ReportBuilder Developer's Guide.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2004
    Ok, i had created and implemented the pass thru function!

    It works ok! BUT,

    when i call that function at the 'AfterPrint' event, that event occurs
    when the preview screen show up, not when i send the report to the printer.


    May be i can use the 'on print dialog close' event, but then how can i
    detect (on the Rap) if the user press OK or Cancel ??

    Help!


    Marcelo



  • edited August 2004

This discussion has been closed.