Utilize this straightforward VBA strategy to populate a rundown control with the names of the considerable number of reports in a Microsoft Access database.
Populating a rundown or combo confine with every one of the reports a database is a simple method to show every one of the reports. By picking a report from the control, clients can rapidly view or print a report without knowing how to do as such from the Database window. Luckily, the assignment requires a tad of code behind the shape. To populate a rundown control along these lines, do the accompanying:
- Include a rundown or combo box to a shape and name the control lstReports.
- Set the control’s Row Source Type property to Value List.
- Tap the Code catch to dispatch the shape’s module.
- Enter the accompanying code:
Private Sub Form_Load() ‘Populate lstReports with the name ‘of the considerable number of reports in the database.
Diminish ao As AccessObject For Each ao In CurrentProject.AllReports lstReports.AddItem (ao.Name) Next End Sub Opening the shape in Form see executes the frame’s Load occasion. The For circle spins through the reports in the AllReports accumulation, which contains objects that portray cases of the considerable number of reports in the database.
To know about more Article to visit : Office/com setup