Make a text box grow or shrink to fit data when printing a form or report

It's often hard to predict the size a text box should be to accommodate the data it might contain. For that reason, Access provides support for dynamically growing or shrinking a text box.

Introducing the CanShrink and CanGrow properties

Access uses two properties to determine whether to adjust the size of a control to accommodate the data it contains — the CanGrow property and the CanShrink property. The CanGrow property tells Access whether to grow a control vertically when printed or previewed to display all the data in the control. The CanShrink property tells Access whether to shrink a control vertically when printed or previewed to remove empty space. You can set the CanGrow and CanShrink properties for text box controls, form and report sections, subform controls, and subreport controls.

To remove empty lines, you can set the CanShrink property for each text box on a line to Yes. The key point to remember is this: Access shrinks controls vertically, so the entire vertical area that bounds the text box must be empty. This means that if several controls exist on a line, they must all be empty for Access to automatically close up the space.

Using the CanShrink property on a text box

The default setting for the CanShrink property is No, so controls can't shrink unless you change this setting to Yes. If you also want the entire report section to shrink, set the report section's CanShrink property to Yes.

For information about how to remove empty lines, such as those that might appear in an address label, see Eliminating unwanted blank lines in labels and reports.

 
 
Applies to:
Access 2003