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

Conditionial Page break in report??

Status
Not open for further replies.

waldemar

Programmer
Nov 15, 2001
245
0
0
DE
I am formatting table entries into a reports detail section where the entry can either be a header or some detailed data.

Now I would like to create a page break inside the format-event similar to word. "If the header is the last thing on the report and the details wouldnt fit onto the same page, then forward the header to the next page also).

One approach was finding out, at what Y-Position I am in the current report and issue the page break through a tresshold value. Unfortunately the very promising looking property "CurrentY" always returns 0 (I exptected the absolute Y-Position of the report page)...

Has anybody a solution for this (or does anybody understand me)?
 
Have you looked at the ForceNewPage and KeepTogether properties for the Header section. That may do everything you need without the pagebreak.


Paul
 
Yes, but I think that doesnt apply since each header and each piece of data is a single detail-field. It's all in one normalization level; VBA is used to format the differences betweend header and data.
 
Is there some way to add another field that ties the Header/Detail record together. What I'm thinking is a numeric field something like this
Code:
1  HeaderValue
    1 DetailValue

2  HeaderValue
    2 DetailValue

Then set the numeric field Visible Property to No, and use the Keep Together property for the Detail section. This may keep things together.
If there is only one header record and one detail record then you could put a text box in the Detail section. Set it's control source to =1, set it's running sum property to Over All, and then put something like this in the Format Event for that section

If Me.TextboxName Mod 16 = 0 Then
Me.PageBreakName.Visible = True
Else
Me.PageBreakName.Visible = False
End If

This would give you 16 records per page 8 headers/ 8 detail
You can increase or decrease the number by changing 16 but as long as it's an even value then your header/detail should stay together.

Paul
 
See Microsoft Knowledge Base Article Q210508. That should help solve your problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top