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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

suppress blank subreports 1

Status
Not open for further replies.

zapzip

Technical User
Jun 19, 2007
46
US
I have a report with numerous subreports. The subreports only have data sometimes (a single dollar amount and a description). The report is laid out as a spread sheet with all the sub reports in the same column.

How can I have the report not take up a blank row when there is no data in some or all the sub reports.
 
Firstly I would set the 'Can Shrink' property of the section of the main report where the sub-reports are placed to 'Yes', and do the same for the sub-report object too.

If that doesn't do what you require, you can also utilise the 'HasData' property of the sub-report object to alter formatting. For example, you could put this code in the OnFormat event of the main report to display a explanatory label instead of the sub-report.

Code:
    If Me.srpSub-Report1.Report.HasData = False Then
       Me.lblNo_Sub-Report_Data.Visible = True
    Else
       Me.lblNo_Sub-Report_Data.Visible = False
    End If

Any good?
 
Thanks for the help. The Can shrink prop[erty did the trick on all the rows except the very 1st. This row contains fields from the main report & one col for the sub reports. When its this subreport is blank it dispalys as empty. Would like to force the subreports below the blank into this empty slot.

ANy ideas?
 
I don't think this can be done with the 'Can Shrink' property as it needs to be able to shrink across the entire width of the page, so if there are objects to the left or right of the empty sub-report you won't be able to reclaim this space.

Perhaps displaying an explanatory label instead (as I've shown in the example) may make the report look 'less odd'.
 
Is there some way to do this with code?
 
Is there some way to do this with code?

Displaying a label or positioning the other sub-reports?

Displaying a label? Yes - something like I've shown in my first reply.

Positioning the other sub-reports? Possibly... I think you can set the position of any object on a report using VBA, though I can't claim to have ever done it myself.

Personally I'd try and find a satisfactory alternative before attempting to position all the sub-reports with code...

Maybe...
Move the sub-reports under the main report data?
Display an alternative label?
Is there a sub-report that will always have data you could position as the first?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top