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!

Hiding controls in section still gets page with Force New Page

Status
Not open for further replies.

lameid

Programmer
Jan 31, 2001
4,208
US
I have a report that I group by the unique key for the recordsource to add a few extra header sections to the report. Largely this is done to use keep together and force new page in preferred ways. It is a long report height-wise.

In some cases I need to hide the detail section. Noteworthy is that the section is set with Can Grow and Can Shrink set to true. Also using EITHER a force new page Before the detail section OR using an After section on the header before the detail section is causing an extra page that is blank except for the page footer. By changing the background color of the detail section it does not look like this page is the detail section nor the previous section as the line I added for testing at the bottom of the section is not on the blank page.

Most of the controls are unbound and set programmatically on the Report header's format event. Additionally, the below code runs to hide the controls in the detail section... obviously in this case blHideSection is true.


Code:
  If blHideSection Then
    'Hide all controls in Detail section
    For Each ctl In Me.Section(acDetail).Controls
      ctl.Visible = False
    Next ctl
  End if

Everything in the detail section is not visible, so everything should collapse and seems to except that there seems to be a phantom page left over.

I am hoping something jumps out at someone. I am not even having ideas of anything to try or research at the moment.




 
The solution is so easy I feel like an idiot for not thinking of trying it right away. Instead of using Force new page (before or after section), I added a page break control and then made it invisible at the same point I did the controls in the detail section. Obviously the page break is in the section before.

It was too obvious. My brain needed the weekend to stew on that one. The old "can't see the forest for the trees" problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top