Blank pages in Report (1 Viewer)

Minogue

New member
Local time
Yesterday, 17:41
Joined
Nov 10, 2015
Messages
6
I have a report where the logic hides (does not display) the subreports if there is no data in them. They are set to shrink and grow, but the problem is that i guess it still takes up room on the page and spits out a blank page at the end of each grouping if it is close to rolling over a page. Does anyone know how to have it not print the page if it has hidden data on it and is blank? Thanks in advance for any help.
 

Pyro

Too busy to comment
Local time
Today, 10:41
Joined
Apr 2, 2009
Messages
126
You can set the height of the subreports to 0, and if there are multiples, stack them close to each other. Alternatively, you could place them in their own group and set the visible state of that group to false when the srpt has no data.
 

Minogue

New member
Local time
Yesterday, 17:41
Joined
Nov 10, 2015
Messages
6
Thanks for the quick reply! :)

I've tried that, but unfortunately that one line is enough to have it spill over occasionally as the report is 400 pages long. I guess i was looking for a way to write the logic that if the page contained only hidden data then delete said page.
 

Pyro

Too busy to comment
Local time
Today, 10:41
Joined
Apr 2, 2009
Messages
126
If you have the srpt in its own group, you should be able to set the visibility for the entire group, which should give you the desired result.

Code:
If me.<yoursrpt>.Report.HasData then
     me.<mygroup>.visible = True
Else
     me.<mygroup>.visible = False
End If
 

Minogue

New member
Local time
Yesterday, 17:41
Joined
Nov 10, 2015
Messages
6
Thanks again. That is the code i have used to show and not show the subreports. I also have some verbiage etc that gets displayed or not depending on certain criteria, but even though it is "hidden" I guess access still sees that as space and spits out a blank page of the hidden data?

I've tried making the material it's own group and then setting the height to 0, but it just takes all the individual items and collapses to 0 instead of the group as a whole. Basically there is just enough of the "0" height items so that it occasionally makes it spill over on to another page which in turn spits out blank. I would just delete out the pages in the subreport, but then the page numbers don't jive and it looks like there is missing data.
 

Pyro

Too busy to comment
Local time
Today, 10:41
Joined
Apr 2, 2009
Messages
126
Is there a page break after your subreport? If so, it might work to set the pagebreak control to invisible in the .hasdata test.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 01:41
Joined
Sep 12, 2006
Messages
15,710
I have a report where the logic hides (does not display) the subreports if there is no data in them. They are set to shrink and grow, but the problem is that i guess it still takes up room on the page and spits out a blank page at the end of each grouping if it is close to rolling over a page. Does anyone know how to have it not print the page if it has hidden data on it and is blank? Thanks in advance for any help.

do you mean you are just wasting a single line of space or so?
how much blank space is there?
do you have "new page after group" set to true? Is that happening very occasionally. You get a blank subreport causing a page throw, and then you get your real new page.

The trouble is that what a report does is this: prints the header and footer, and then uses the remaining space for detailed records. If there isn't enough room for a given detailed record it advances to a new page. It's quite hard to control what a print does at an atomic level. you have "keep together", "force new page", and so on, but it's hard to completely control what happens at the bottom of a page.

if you want absolute precision, then maybe the alternative is to iterate a recordset, design the report as a text file, with fixed width strings, and count 66 lines per page. You won't get graphics though, just text.
 

Minogue

New member
Local time
Yesterday, 17:41
Joined
Nov 10, 2015
Messages
6
Thanks again as I am a bit new to Access. Figured it out: Created a new group as suggested, put all the items witin that group and then set entite group as visible or not depending on certain criteria.
 

Users who are viewing this thread

Top Bottom