You can use the Section property to identify a section of a form or report and provide access to the properties of that section. You can also identify controls by the section of a form or report where the control appears.
Setting
The Section property is an Integer data type value corresponding to a particular section. You can use Integer values or the 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.
The Section property is read-only in all views.
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
Remarks
For forms and reports, you must combine the Section property with other properties that apply to form or report sections. 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
For controls, you can use the Section property to determine which section of a form or report a control is in. The following example uses the Section property to determine which section contains the CustomerID control.
Dim intSectionNumber As Integer
intSectionNumber = Forms!Customers!CustomerID.Section