Wednesday, November 8, 2017

Section Property

Section Property

Applies to

BoundObjectFrame Object

Image Object

OptionGroup Object

TabControl Collection

CheckBox Object

Label Object

Page Object

TextBox Object

ComboBox Object

Line Object

PageBreak Object

ToggleButton Object

CommandButton Object

ListBox Object

Rectangle Object

CustomControl Object

ObjectFrame Object

Report Object

Form Object

OptionButton Object

SubForm Object

Section property as it applies to controls on a form or report.

You can identify these controls by the section of a form or report where the control appears. Read/write Integer.

expression.Section

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

Remarks

For controls, you can use the Section property to determine which section of a form or report a control is in.

Section property as it applies to the Form and Report objects.

You can use the Section property to identify a section of a form or report and provide access to the properties of that section. Read-only Section object.

expression.Section(Index)

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

Index    Required Variant. The section number or name.

Remarks

The Section property corresponds to a particular section. You can use the following constants listed below. It is recommended that you use the constants to make your code easier to read.

Setting

Constant

Description

0

acDetail

Form detail section or report detail section

1

acHeader

Form or report header section

2

acFooter

Form or report footer section

3

acPageHeader

Form or report page header section

4

acPageFooter

Form or report page footer section

5

acGroupLevel1Header

Group-level 1 header section (reports only)

6

acGroupLevel1Footer

Group-level 1 footer section (reports only)

7

acGroupLevel2Header

Group-level 2 header section (reports only)

8

acGroupLevel2Footer

Group-level 2 footer section (reports only)


If a report has additional group-level sections, the header/footer pairs are numbered consecutively beginning with 9.

For forms and reports, the Section property is an array of all existing sections in the form or report specified by the section number. For example, Section(0) refers to a form's detail section and Section(3) refers to a form's page header section.

You can also refer to a section by name. The following statements refer to the Detail0 section for the Customers form and are equivalent.

Forms!Customers.Section(acDetail).Visible

Forms!Customers.Section(0).Visible

Forms!Customers.Detail0.Visible

For forms and reports, you must combine the Section property with other properties that apply to form or report sections.

Example

As it applies to controls on a form or report.

The following example uses the Section property to determine which section contains the CustomerID control.

Dim intSectionNumber As Integer
intSectionNumber = Forms!Customers!CustomerID.Section

As it applies to the Form and Report objects.

The following example shows how to refer to the Visible property of the page header section of the Customers form.

Forms!Customers.Section(acPageHeader).Visible

Forms!Customers.Section(3).Visible

No comments:

Post a Comment