Share via


Visual Basic Reference

Sections Collection Example

The example prints the name of each Section object in the Data Report designer as well as the names of each control in the section. To try the example, create a Data Report. Place a CommandButton control on a form, and paste the code into the Declarations section of the code module. Press F5 to run the project and click the button.

  Private Sub Command1_Click()
   Dim sect, ctl
   For Each sect In DataReport1.Sections
      Debug.Print "Section", sect.Name
      For Each ctl In sect.Controls
         Debug.Print , ctl.Name
      Next ctl
   Next sect
End Sub