Use this simple VBA procedure to populate a list control with the names of all the reports in a Microsoft Access database.
- Add a list or combo box to a form and name the control lstReports.
- Set the control's Row Source Type property to Value List.
- Click the Code button to launch the form's module.
- Enter the following code:
Private Sub Form_Load()
'Populate lstReports with the name
'of all the reports in the database.
Dim ao As AccessObject
For Each ao In CurrentProject.AllReports
End SubOpening the form in Form view executes the form's Load event. The For loop cycles through the reports in the AllReports collection, which contains objects that describe instances of all the reports in the database.