Sunday, February 26, 2017

Top Property

Top Property

Applies to

BoundObjectFrame Object

Image Object

OptionButton Object

Report Object

CheckBox Object

Label Object

OptionGroup Object

SubForm Object

ComboBox Object

Line Object

Page Object

TabControl Collection

CommandButton Object

ListBox Object

PageBreak Object

TextBox Object

CustomControl Object

ObjectFrame Object

Rectangle Object

ToggleButton Object

You can use the Top property to specify an object's location on a form or report. Read/write Integer for all of the objects in the Applies To list except for the Report object, which is read-only Long.

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

Remarks

A control's location is the distance measured from its left or top border to the left or top edge of the section containing the control. Setting the Top property to 0 places the control's edge at the very top of the section. 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, 3 cm or 2 in).

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

For controls, you can set this property by using a control's property sheet, a macro, or Visual Basic for Applications (VBA) code.

When you move a control, its new Top property setting is automatically entered in the property sheet. When you view a form or report in Print Preview or when you print a form, a control's location is determined by its Top property setting along with the report's margin settings, available by clicking Margins on the Page Layout tab.

For reports, the Top property setting is the amount the current section is offset from the top of the page. This property setting is expressed in twips. You can use this property to specify how far down the page you want a section to print in the section's Format event procedure.

Example

The following example checks the Top property setting for the current report. If the value is less than the minimum margin setting, the NextRecord and PrintSection properties are set to False. The section doesn't advance to the next record, and the next section isn't printed.

Sub Detail1_Format(Cancel As Integer, _
FormatCount As Integer)
Const conTopMargin = 1880
' Don't advance to next record or print next section
' if Top property setting is less than 1880 twips.
If Me.Top < conTopMargin Then
Me.NextRecord = False
Me.PrintSection = False
End If
End Sub

No comments:

Post a Comment