Height Property

Applies to

BoundObjectFrame Object Image Object OptionButton Object Section Object
CheckBox Object Label Object OptionGroup Object SubForm Object
ComboBox Object Line Object Page Object TabControl Collection
CommandButton Object ListBox Object Rectangle Object TextBox Object
CustomControl Object ObjectFrame Object Report Object ToggleButton Object

You can use the Height property (along with the Width property) to size an object to specific dimensions. Read/write Integer for all objects in the Applies To list except for the Report object, which is a read/write Long.

expression.Height

expression Required. An expression that returns one of the above objects.

&nbspRemarks

The Height property applies only to form and report sections, not to forms (form: An Access database object on which you place controls for taking actions or for entering, displaying, and editing data in fields.) and reports (report: An Access database object that you can print, which contains information that is formatted and organized according to your specifications. Examples of reports are sales summaries, phone lists, and mailing labels.).

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

You can set this property by using the object's property sheet (property sheet: A pane that is used to view or modify the properties of various objects such as tables, queries, fields, forms, reports, data access pages, and controls.), a macro (macro: An action or set of actions that you can use to automate tasks.), or Visual Basic for Applications (VBA) (Visual Basic for Applications (VBA): A macro-language version of Microsoft Visual Basic that is used to program Microsoft Windows-based applications and is included with several Microsoft programs.) code.

For controls, you can set the default for this property by using the default control style (default control style: The default property setting of a control type. You customize a control type before you create two or more similar controls to avoid customizing each control individually.) or the DefaultControl property in VBA code.

In VBA, use a numeric expression (numeric expression: Any expression that evaluates to a number. The expression can be any combination of variables, constants, functions, and operators.) to set the value of this property. Values are expressed in twips (twip: Unit of measurement that is equal to 1/20 of a point, or 1/1,440 of an inch. There are 567 twips in a centimeter.).

For report sections, you can't use a macro or VBA code to set the Height property when you print or preview a report. For report controls, you can set the Height property when you print or preview a report only by using a macro or an event procedure (event procedure: A procedure that is automatically executed in response to an event initiated by the user or program code, or that is triggered by the system.) specified in a section's OnFormat event property setting.

You can't set this propery for an object once the print process has started. For example, attempting to set the Height property in a report's Print event generates an error.

Microsoft Office Access 2007 automatically sets the Height property when you create or size a control or when you size a window in form Design View (Design view: A view that shows the design of these database objects: tables, queries, forms, reports, and macros. In Design view, you can create new database objects and modify the design of existing objects.) or report Design view (Design view: A view that shows the design of these database objects: tables, queries, forms, reports, and macros. In Design view, you can create new database objects and modify the design of existing objects.).

The height of sections is measured from the inside of their borders. The height of controls is measured from the center of their borders so controls with different border widths align correctly. The margins for forms and reports are set by clicking Margins on the Page Layout tab.

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

Example

The following code resizes a command button to a 1-inch by 1-inch square button (the default unit of measurement in VBA is twips; 1440 twips equals one inch):

Me!cmdSizeButton. = 1440    ' 1440 twips = 1 inch.
Me!cmdSizeButton.Width = 1440
      
 
 
Applies to:
Access 2007