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

New Report Questions - Please help.

edited March 2004 in End User
*This may have been asked and answered but I don't know what to search on to
find it*

Delphi 7
RB7.03

I have a application that lets the users create, save and run their own
reports connecting to a MSSQL 2000 db via ADO.

My program has a ReportDesigner and a TppReport component and I set the
relevant options and the call ShowModal.

All works well until the user closes the Designer, and then Opens it again,
the old report is still there. How do I get it to start a new report? Do I
have to Create a New TppReport in Code and assign it?

Also if the user stays in the Designer and clicks New Report the FileName
and the Tables/Fields in DADE are still present, everything else is cleared.

Am I missing something?

Please help.

Thanks,

Daniel

Comments

  • edited April 2004

    1. Programmatically you can call Report.Template.New to clear the report
    layout. However by design, the data access objects are not free'd. (Same is
    true when the user select Report | New in the Designer.

    2. Call the Report.FreeModules method to clear any TdaDataModule and
    TraCodeModule objects associated with the report.

    3. Use the Report.Template.OnNew event to free.

    Example:

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    {assign OnNew event handler}
    ppReport1.Template.OnNew := ehTemplateOnNew;

    end;

    procedure TForm1.ehTemplateOnNew(Sender: TObject);
    begin
    ppReport1.FreeModules;
    end;




    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2004
    your a legend
    thanks for the help, its nice to see some examples in a newsgroup rather
    than a vague reference.
    Dan


This discussion has been closed.