Access JumpStart 2.0 | Blog

A Rapid Development Framework for Microsoft Access

I had generally used Subforms in Subform/Subreport controls as part of a standard form. I hadn’t even really thought too much about the fact that you could put report objects into a Subform/Subreport control.

What pushed me in the direction of using a report in a Subform/Subreport control? It turns out that reports will utilize the CanGrow properties of various Access controls like TextBoxes. When turning on the CanGrow property in a form, nothing happens. The property is only utilized when formatting the report for printing. The property allows text in the TextBox to expand the height of the control to the content. So you can format the field for one line, but let’s say your text contains a line break or will wrap to 2 lines. This control will grow vertically to accommodate both lines and make the height of the whole line large enough to accommodate this (as long as the section the control is in ALSO has it’s CanGrow property turned on.

In one case, I have used the report object to show totals for a Purchase Order by Account Number. Another reason to use reports is the report grouping feature. You can’t group rows on forms like you can on reports. Forms don’t support grouping at all in fact, so if you need to add group headers or footers to a continuous form, you are out of luck, or need to code against Access functionality to get it to work. I would not recommend trying to code around Access functionality. It’s been an exercise in unexpected bug fixes for me when I have. However, by using reports for these purposes, I have been able to create multiple nested grouping totals with subtotals and grand totals.

There are a lot of differences in the events of the reports and forms in subform/subreport controls. And some of the events don’t fire unless you are specifically printing the report to a printer. Still there are a lot more things you can do if you have reports AND forms in your arsenal. Knowing some of these differences helps you to decide what to use.

Really, continuous forms are best for user input. That’s what they are geared towards. Reports, on the other hand, are generally better for formatting and displaying data. They were created to display summarized data and so are very good at it.

I’d love to hear your adventures in using subforms and subreports. Let me know via the contact form on the web site or via email.