Cannot free Report Builder Objects
Hi there,
I am generating all my reports from code, there is no Design-Time
configuring taking place,
Report objects, and all it's sub objects are all created in code.
My problem is this :
The report has multiple sub-reports within subreports within subreports.
I generate the report and all is fine - placement is correct drill-down on
subreport within subreport all works well
- nothing wrong(The 1st time I generate the report)
I then close the print preview modal form and attempt to FreeAndNil the
report object so
that I may recreate it, I get an Access Violation,
I create all objects like this .Create(Self) and still the same problem,
I create all objects with their respective containing component the "Owner",
i.e.: ABand := TppBand.Create(AReport);
ALabel := TppLabel.Create(ABand); etc. etc.
and still I get the Access Violation,
I have tried freeing all the child objects manually and individually and
which stops me
from getting conflicting object names but then when I try to display the
newly generated
report I get another Access Violation.
Thanks
-DM
I am generating all my reports from code, there is no Design-Time
configuring taking place,
Report objects, and all it's sub objects are all created in code.
My problem is this :
The report has multiple sub-reports within subreports within subreports.
I generate the report and all is fine - placement is correct drill-down on
subreport within subreport all works well
- nothing wrong(The 1st time I generate the report)
I then close the print preview modal form and attempt to FreeAndNil the
report object so
that I may recreate it, I get an Access Violation,
I create all objects like this .Create(Self) and still the same problem,
I create all objects with their respective containing component the "Owner",
i.e.: ABand := TppBand.Create(AReport);
ALabel := TppLabel.Create(ABand); etc. etc.
and still I get the Access Violation,
I have tried freeing all the child objects manually and individually and
which stops me
from getting conflicting object names but then when I try to display the
newly generated
report I get another Access Violation.
Thanks
-DM
This discussion has been closed.
Comments
Which event are you freeing your report it? If you are perhaps using the
OnPreviewFormClose event, then you are trying to free it before the report
engine has finished. The following example shows how you can use a TTimer
to delay the "Free" call and let the report finish closing.
http://www.digital-metaphors.com/tips/FreeReport.zip
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com