Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmatically suppressing the printing of a subreport

Status
Not open for further replies.
Jan 3, 2001
66
US
I have a complex report for which I want to suppress a section programmatically. The section contains a subreport.

Since there are several sections to the report, I will want to be able to "spin" through the objects to determine whether or not the subreport is actually contained in the section.

Carolyn
 
Hi Carolyn,

I've written with Delphi4 (and VCL for Crystal Reports) the following source:


procedure .....
var
sSectionSubReport: string;
cnt: integer;
begin
// Subreport exists?
Crpe1.Subreports.Retrieve;
try
sSectionSubReport:= Crpe1.Subreports[1].Section;
// this is the sectionname
except
sSectionSubReport:='';
end;

// Determing the section of first subreport
if sSectionSubReport <> '' then begin
// spinning trough Masterreport;
Crpe1.Subreports[0];
Crpe1.SectionFormat.Retrieve;
for cnt:= 0 to (Crpe1.SectionFormat.Count - 1) do
begin
if Crpe1.SectionFormat[cnt].Section =
SectionSubReport then begin

Crpe1.SectionFormat[cnt].Suppress := cTrue;
end;
end;
end;

...

end;

regards

Wolfgang
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top