Populate an Access list control with report names

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:

  1. Include a rundown or combo box to a shape and name the control lstReports.
  2. Set the control’s Row Source Type property to Value List.
  3. Tap the Code catch to dispatch the shape’s module.
  4. 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

Leave a Reply

Your email address will not be published. Required fields are marked *