
add subreport(s) to main report
I have done this manually in
Crystal Reports where I have one main report
and several subreports that are in report footer sections such as RFa,
RFb,RFc, etc. The problem is that if I hide the subreport, the space
allocated for the subreport leaves a gap in the main report and if I have
adjacent reports then the empty space is larger and the report looks bad.
I was thinking that if I could add report footer sections in my code then I
could add the subreports to the sections. I have tried to to this in the
detail section, but when I add the next subreport it prints over top of the
previous subreport. I have not been able to find code that allows me to add
sections and insert the subreports. Thanks for your reply and let me know if
you hvae any to add to it.
Thanks,
Tom
Quote:
> You can add subreport at runtime by calling AddSubreportObject method on a
> section object. You would need to then add sections and fields within the
> subreport, in effect, dynamically design a report. You could then specify
> links between main report and subreport by calling Add method on the
> SubreportLinks method.
> Unless you are fairly familiar with adding/removing
sections/fields/objects
Quote:
> on a report at run time, I wouldn't recommend you trying the above method.
> Instead if you know the maximum number of places where you could have
> subreport, you may wish to design the subreports in advance. Then use VB
to
> hide/unhide the subreports depending on user input.
> > How can I add subreport(s) to a main report. I have a main report that
> could
> > contain a few subreports depending on what the user selects in the VB
app.
> I
> > have looked at user forum and knowledgebase on Crystal's site, but no
> > helpful info. Should I add the subreports to the end of the detail
section
> > or create a new section for each subreport? I have a field that links
the
> > reports together so I also need to set the link up in code. Any code
> > examples or suggestions would be appreciated. I have done this manually,
> but
> > do not know how to do it in VB code.
> > Thanks,
> > Tom