CanShrink Property

Microsoft Access Visual Basic

  • The CanShrink property does not apply to form or report page header and page footer sections, although it does apply to controls in such sections.
  • This property affects 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.
  • Read/write Boolean.

    expression.CanShrink

    expression    Required. An expression that returns one of the objects in the Applies To list.

    Setting

    The CanShrink property uses the following settings.

    Setting Visual Basic Description
    Yes True The section or control shrinks vertically so that the data it contains can be printed or previewed without leaving blank lines.
    No False (Default) The section or control doesn't shrink.

    Note  You can set this property only by using the section or control's property sheet.

    For controls, you can set the default for this property by using the default control style or the DefaultControl method in Visual Basic.

    This property setting id read-only in a macro or Visual Basic in any view but Design view.

    Remarks

    You can use this property to control the appearance of printed forms and reports. When you set the property to Yes, the object automatically adjusts so any amount of data can be printed. When a control shrinks, the controls below it move up the page.

    If you set a control's CanShrink property to Yes, Microsoft Access does not set the section's CanShrink property to Yes.

    Sections 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 shrink the data independently, you can place two subform or subreport controls side by side, and set their CanShrink property to Yes.

    When you use the CanShrink property, 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 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.