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!

Blank page to avoid 1

Status
Not open for further replies.

teqtaq

Technical User
Nov 18, 2007
197
US
I have several (5) subreports in Main one.
Each has page break after it.
However if SUB has no data - it shows blank page.
Is there way to avoind it?


Thanks
 
You can set the visible property of the page break:

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.The_subreport.Report.HasData Then
    Me.ThePageBreak.Visible = True
Else
    Me.ThePageBreak.Visible = False
End If

End Sub
 
WOW! I would never guess! Thanks Remou!!!!!!!!!!!!!!!
 
Or
If Not Me.The_subreport.Report.HasData Then
Cancel = True
end if

"Rome did not create a great empire by having meetings, they did it by killing all those who opposed them."
 
genomon
I cannot get your code to cancel a manual pagebreak.
 
Sorry for the snippet. Works for one of my subforms in the report footer format event. Should have looked before I leapt (leaped?). May come in handy, but not germane here.

"Teamwork means never having to take all the blame yourself."
 
Sorry everyone, I am having a trouble with SUBs again.
Some will still show blank pages.

How about if NOData do something...?

I have all 7 now in Group Header.
 
I am using yours, Remou.
Except my Report is in GH so I use:

Private Sub GH0_Format(Cancel As Integer, FormatCount As Integer)
If Me.The_subreport.Report.HasData Then
Me.ThePageBreak.Visible = True
Else
Me.ThePageBreak.Visible = False
End If

End Sub

Please, help.
Seems like even it has no page break - it is still taking up space. I had heard about setting Height to a Null. But I doubt it. Thanks
 
What is GH? You must change the names (The_subreport, ThePageBreak) to match your names.
 
Yes, I did, GH is s Group Header, I though you all using this abbreviation:) sorry.

OK, my code is

Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)


If Me.Candidate_Pipeline_Review_1.Report.HasData Then
Me.PageBreak98.Visible = True
Else
Me.PageBreak98.Visible = False
End If

If Me.Interview_1.Report.HasData Then
Me.PageBreak97.Visible = True
Else
Me.PageBreak97.Visible = False
End If

If Me.Report_2.Report.HasData Then
Me.PageBreak99.Visible = True
Else
Me.PageBreak99.Visible = False
End If


End Sub

Thanks
 
Remou, your code worked, I was using it in a wrong place. Thanks and sorry.
 
Have a look at the printsection method


reports!reportname.printsection = false


Ian Mayor (UK)
Program Error
Your lack of planning is not my emergency!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top