A family of Microsoft relational database management systems designed for ease of use.
Everyone,
I've done some experimenting. The PageBreak can be turned on and off in VB handler for the ONFORMAT event, but I knew that. I developed some logic that would tell how much space a section required. I used the .top property of the section to get its top and I created a dummy section footer so I could use the .top of that to get the bottom. (My section has two subforms that can both grow quite a bit.) Now I know how much space a section needs. I can do this again for the next section and if that section is small enough I can turn off the PageBreak. But at this point it's too late because the second section has already been formatted!
I was about to write some code to format the report in two passes with the first pass recording the section sizes and the second pass controlling the PageBreak. I think I could have made that work.
HOWEVER: Then I thought, wouldn't it be nice if the Keep Together property would work with both the section header and the detail section. But it doesn't, it only applies to a single section. Now my report had a header section and a detail section, but the detail section in this report does not repeat. That's because there are two repeating groups which require two subforms. For this reason, I didn't need a header section. So I moved all the header fields into the detail section. Now Keep Together does just what I want and I don't have to experiment with VB for now.
It would seem the solution is to use a sub report instead of a repeating detail section and use the Keep Together property of the detail section to get the page breaks to work as I wish. I have no problem with sub reports, but it seems a little kludgy. On the other hand, it does what I want and it's a lot less kludgy than my two-pass approach.
Rich