Make a subreport conditionally invisible
Hi,
If the DB calc (sum) in the summary of a subreport is = zero then I want to
make the entire subreport invisible.
How do I do this?
I tried:
===
procedure SubReport1OnPrint;
if DBCalc1.Value = '0' then
SubReport1.Visible := true
else
SubReport1.Visible := false;
===
but got the error:
Error: SubReport1OnPrint, Line 4: Undeclated Identifier: 'SubReport1'.
What am I doing wrong?
Thanks
Redmond
If the DB calc (sum) in the summary of a subreport is = zero then I want to
make the entire subreport invisible.
How do I do this?
I tried:
===
procedure SubReport1OnPrint;
if DBCalc1.Value = '0' then
SubReport1.Visible := true
else
SubReport1.Visible := false;
===
but got the error:
Error: SubReport1OnPrint, Line 4: Undeclated Identifier: 'SubReport1'.
What am I doing wrong?
Thanks
Redmond
This discussion has been closed.
Comments
Try using the Band.BeforePrint event of the main report to set the
visibility of the Subreport. Setting the subreport's visibility inside the
subreport will not give you the results you are after.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks, but the problem I have is that the DBCalc on which the condition
rely's upon is IN the subreport, so I now get the error:
Error: ReportBeforePrint, Line3: Undeclared Indentifier: 'DBCalc1'.
Thanks
Redmond
Unfortunately once the subreport has begun the generation process, it is not
possible to set it's visiblity. I would recommend calculating this sum
before printing the report perhaps with a separate query or in Delphi code,
then using this information to determine whether the subreport is visible or
not.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com