View Full Version : Page Break Problem


TKnight
08-19-2005, 03:18 AM
Hi,

I have a report that contains just over half a page of data and then two sub reports. I have set the subreports "Can Shrink" property to "Yes" so that if they don't contain any data everything fits onto one page which is what I want. When there is data in the subreports though, I want it to display on a new page. I tired forcing a new page in the first sub reports header but have since found out on here that those properties don't work for sub reports. I also added a page-break before the sub reports but this creates an un-necessary page when the sub reports are empty. I don't have a field that I can use to create a suitable group.

I thought I might be able to use the No data event of the sub report to enable/disable the page break but as far as I can see no such property exists.

Does anyone know of a way that I can sort this?

Thanks, Tom

Hayley Baxter
08-19-2005, 03:39 AM
You can create a macro to force a page break if a condition is met or alternatively you can do this using VBA. You'll need to firstly select the page break control on the toolbox and position this where you would like the page break to appear (which you have already done)

If using a macro you'll need 2 macros, one that sets the page break's visible property to false and another that sets this to true if a condition is met.

If using VBA set it to false:

me.pagebrkname.visible = false

then set it to true if condition met:

if me! [condition] then
me![pagebrkname].visible = true
End if