CanGrow, CanShrink Properties
Applies To
Form section, Report section, Subform/Subreport control, Text Box control.
Description
You can use the CanGrow and CanShrink properties to control the appearance of sections or controls on forms and reports that are printed or previewed. For example, if you set both properties to Yes, a section or control automatically adjusts vertically to print or preview all the data the section or control contains.
Notes
- The CanGrow and CanShrink properties don't apply to form or report page header and page footer sections, although they do apply to controls in such sections.
- These properties affect the display of form sections and controls only when the form is printed or previewed, not when the form is displayed in Form view, Datasheet view, or Design view.
Setting
The CanGrow property uses the following settings.
Setting | Description | Visual Basic |
|
Yes | The section or control grows vertically so that all data it contains can be printed or previewed. | True (–1) |
No | (Default) The section or control doesn't grow. Data that doesn't fit within the fixed size of the section or control won't be printed or previewed. | False (0) |
The CanShrink property uses the following settings.
Setting | Description | Visual Basic |
|
Yes | The section or control shrinks vertically so that the data it contains can be printed or previewed without leaving blank lines. | True |
No | (Default) The section or control doesn't shrink. | False |
You can set these properties only by using the section or control's property sheet.
For controls, you can set the default for these properties by using the default control style or the DefaultControl method in Visual Basic.
These property settings are read-only in a macro or Visual Basic in any view but Design view.
Remarks
You can use these properties to control the appearance of printed forms and reports. When you set both properties to Yes, the object automatically adjusts so any amount of data can be printed. When a control grows or shrinks, the controls below it move down or up the page.
If you set a control's CanGrow property to Yes, Microsoft Access automatically sets the CanGrow property of the section containing the control to Yes. (However, if you set a control's CanShrink property to Yes, Microsoft Access doesn't set the section's CanShrink property to Yes.)
Sections grow and shrink vertically across their entire width. For example, suppose a form has two text boxes side by side in a section, and each control has its CanShrink property set to Yes. If one text box contains one line of data and the other text box contains two lines of data, both text boxes will be two lines long because the section is sized across its entire width. To grow and shrink the data independently, you can place two subform or subreport controls side by side, and set their CanGrow and CanShrink properties to Yes.
When you use the CanGrow and CanShrink properties, remember that:
- The property settings don't affect the horizontal spacing between controls; they affect only the vertical space the controls occupy.
- Overlapping controls can't grow or shrink.
- The height of a large control can prevent controls beside it from shrinking. For example, if several short controls are on the left side of a report's detail section and one tall control, such as an unbound object frame, is on the right side, the controls on the left won't shrink, even if they contain no data.
See Also
Format event, Retreat event.