Height, Width Properties

Applies To

  • Height Property — Bound Object Frame Control, Chart Control, Check Box Control, Combo Box Control, Command Button Control, Form Section, Image Control, Label Control, Line Control, List Box Control, Option Button Control, Option Group Control, Rectangle Control, Report Section, Subform/Subreport Control, Text Box Control, Toggle Button Control, Unbound Object Frame Control.
  • Width Property — Bound Object Frame Control, Chart Control, Check Box Control, Combo Box Control, Command Button Control, Form, Form Section, Image Control, Label Control, Line Control, List Box Control, Option Button Control, Option Group Control, Rectangle Control, Report, Report Section, Subform/Subreport Control, Text Box Control, Toggle Button Control, Unbound Object Frame Control.

Description

You can use the Height and Width properties to size an object to specific dimensions. This can be useful, for example, if you want to create objects that are exactly the same size or that have the same width or height.

Setting

Enter a number for the desired height or width in the current unit of measurement. To use a unit of measurement different from the setting in the Regional Settings section of the Windows Control Panel, specify the unit, such as cm or in (for example, 5 cm or 3 in).

You can set these properties using the object’s property sheet, a macro, or Visual Basic.

For controls, you can set the default for these properties using the default control style.

In Visual Basic, use a numeric expression to set the value of each property. Values are expressed in twips.

You can’t set these properties for an object once the print process has started. For example, attempting to set the Height property in a report’s OnPrint event generates an error.

Remarks

Microsoft Access automatically sets the Height and Width properties when you create or size a control or when you size a window in form or report Design view.

The height and width of forms and reports are measured from the inside of their borders. The height and width of controls are measured from the center of their borders so controls with different border widths align correctly. The margins for forms and reports are set in the Page Setup dialog box.

Note To set the left and top location of an object, use the Left and Top properties.

See Also

BorderWidth Property; InsideHeight, InsideWidth Properties; Left, Top Properties; MoveSize Action; WindowHeight, WindowWidth Properties.

Example

The following code resizes a command button to a 1-inch by 1-inch square button (and assumes the default unit of measure is set to twips).


Me!cmdSizeButton.Height = 1440    ' 1440 twips = 1 inch.!cmdSizeButton.Width = 1440