First of all, it’s good to know that you can add a report to a sub-report control on a form.
If you need to display multiple groups of data for informational purposes on the form, this can be a real game changer!
I have a routine I use that’s in my library to automatically adjust the height of the sub-report control (or sub-form control) based on it’s content and the room available on the parent form.
It worked well to just add the form height sections together after it rendered for sub-forms. I can directly access each form section and add their heights together to get the full height and multiply the detail height by the number of records displayed.
But when I switched to using a sub-report, all of a sudden, if you have groupings and the records go through those groupings multiple times it can get very tricky to determine the height. You have to know what groupings are there and how many times each one is grouping.
A much easier way is to simply add a text box to each section with [that section’s name].[Height] and set the field to a running sum field.
Then in the footer you place a final height calculation text box to add up all the previous section control values.
Woo-hoo, this works! The only caveat is that my routine is now dependent on a single control on the sub-report to have the value of the height of the full sub-report.
Sneaky sneaky! I like it.
Haha, thanks. It made it way easier to do it that way rather than trying to figure out how many groups were being created!