View Full Version : Hide Subreports with no data


William Smith
08-20-2007, 03:59 PM
On my main report I have several subreports that are being pulled from different tables. If a subreport has no data, I wish that the subreports below them "move up" in order to save printing space. Please see attachement. I know how to save the space with fields (can shrink) but not subreports themselves. Each of the boxes (in the lower half of the report) you see are actually memo fields and are individual subreports.

You'll note that this report is actually 2 pages long. There are subsequent subreports on page two.

Thank you in advance for any help with this (everyone of my reports take two pages if the last subreport has any data).

Rich
08-20-2007, 10:55 PM
Me.MySubreport.Visible=Me.MySubreport.HasData

William Smith
08-21-2007, 07:44 AM
Rich,

I can't tell you how much I appreciate your reply...but where do I put this and how. I'm sorry no VB skills.

I truly thank you for you help.

Bill

Rich
08-21-2007, 09:50 AM
In the OnDetail format event of the main report

William Smith
08-21-2007, 10:13 AM
I'm using 2003 and see no OnDetail. Have On Open, Close, Activate, Deactivate, No Data, Page, & Error. Do I implement just as you have written, or do I change the name of "MySubreport"?

Rich
08-21-2007, 10:16 AM
Change the name of the subreport to that of your own, click the detail section of your main report to get the OnDetail format option

William Smith
08-21-2007, 10:22 AM
I take it you refer to the detail header. I see the On Format (for Section Detail) but I have several subreports. I can't understand how to implement this. In the code?

Rich
08-21-2007, 11:06 AM
Me.MySubreport1.Visible=Me.MySubreport1.HasData
Me.MySubreport2.Visible=Me.MySubreport2.HasData
etc etc

William Smith
08-21-2007, 12:09 PM
Rich,

Still can't find OnDetail. I see On Fomat...is this it? Do I place what you are telling me as an event and then code builder? This sure turned out to be all about nothing.