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!

show/hide different subreports

Status
Not open for further replies.
Mar 31, 2003
22
EU
Hi,

I have a listbox(multiselect) on a form with a valuelist of 4 items (SRep1, SRep2, SRep3, SRep4) each one repersents a subreport.

Depending on what items you select I want to show only thoes subreports on the main report. Also, there is a pagebreak between each subreport. (Is it posibble to show/hide the page break?).

Any help is appreciated ...
 
Hi Jimmy

Design your report to include all 4 sub-reports.

Create an extra field for each subreport in the reports source query which would contain the value true if selected in the list box or false if not.

In the reports "On Format" property enter code to the effect:

If SRep1Selected = true then
Srep1.visible=True
Else
SRep1.visible = false
End If

And the same for SRep2,3 and 4.

Finally select all the fields in all of the subreports and set "Can shrink" = true

This should do it. It sounds harder than it really is!

Tony





and then in the reports "On Format" property
 
Thanks Tony,

I will give it a go tomorrow at work, what about the page breaks between each subreport that are already set in the report design. Wont they still be set ?
 
Hi

I'm not sure about the page breaks but I would imagine that if the subreport is invisible (because it was not selected) the page break would not be seen either and will not happen. I think this one is a "suck it and see" situation. Of course you can control the page breaks in code within the "On Format" property.

If you need more help, let me know!

Tony
 
a pagebreak also has a pgb.visible which can be set to F or T.
you might also start the subreport with a pagebreak, will be automatically 'switched off' when the subrep is visible=F

success
Hans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top