page break and hasdata

Cereldine

Registered User.
Local time
Today, 13:33
Joined
Aug 4, 2005
Messages
71
Hi Ive done a quick search to find out about making a page break visible depending on whether a sub report has any data in it. I need different sub reports on different pages, i have put the page break after each sub report, the problem is if the report has no data it just shows a blank page.
Ive been flitting with this code in both the onopen and detail onformat

Me.pbSick.Visible = False


If Me![rptReview].Report.HasData Then
Me.pbSick.Visible
Else
Me.pbSick.Visible = False
End If

the code stumbles over on the .report.hasdata, i have also tried me.rptreview.report.hasdata then

Can anyone see what my problem is? thanks
 
Me.pbSick.Visible is not a statement and will cause an error. You need to use Me.pbSick.Visible= True.

Or instead of the whole If...Then...Else construct use:
Me.pbSick.Visible=Me![rptReview].Report.HasData

That's a start. Whether it will help your report is another matter. Are these subreports repeating in the detail of the main report, or just sitting at the top or bottom? If they are doing that I set up dummy sections* and give them their own section with a ForcePageBreak value equal to AfterSection. Then I hide the section if it has no data, and no page break occurs. Seems neater, and doesn't require the finicky and annoying PageBreak controls.

*To do this, in the report ordering and grouping box add a new row. Set its source value to =1, move it to the top, and then add a header and footer section, or whichever you need. Each will appear once only. You can also use the ReportHeader and ReportFooter like this, but in case I need more than one I use these. You can add up to 10 per report, so get 20 different sections. I currently need more than that so nest them and can have up to 400 different subreports!

Sam.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom