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

SubReports within Main Report, Hiding Blank Pages HELP 1

Status
Not open for further replies.

PSBA11

MIS
Jul 18, 2011
12
GB
Hi

I have a main report which is filtered for each customer, the report contains about 7 or 8 subreports (Address Book, Feedback, Opportunities, Meeting Details etc) all relating to the chosen customer.

For some customers, there may not be data in the meetings subreport for example. In this case, when the report is viewed and printed it contains a blank page. I would like to get rid of this blank page.

All the Subreports properties have got can grow and can shrink set to "yes" and so are all the fields within the subreports.

How do I go about hiding the blank pages so that they are not previewed or printed??
 
Thank you for your reply.

I have page breaks in between every subreport, so that two subreports don't end up printing on the same page.

I have set all the "Grp Keep Together" Properties for each subreport to "Per Page"

I'm using access 2003 and I'm still getting the same problem.
 
If you have page breaks then you will have page breaks. You can add code in the main report section containing the subreport to set the page break to invisible if the subreport doesn't return any records.

Duane
Hook'D on Access
MS Access MVP
 
thanks dhookom,

I'm afraid I'm not an expert in writing vba codes, what would the code look like and where would I place it??
 
Caution, this is untested code that would be in the On Format event of the section containing the subreport. You will need to substitute your subreport control and pagebreak names.
Code:
[green]'you will need one line like this for each subreport/pagebreak[/green]
Me.PageBreakControlName.Visible = Me.srptControlName.Report.HasData

Duane
Hook'D on Access
MS Access MVP
 
This has worked perfectly, thank you very much!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top