AllReports Object
TOC
Collapse the table of content
Expand the table of content

AllReports Object (Access)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

The AllReports collection contains an AccessObject for each report in the CurrentProject or CodeProject object.

The CurrentProject or CodeProject object has an AllReports collection containing AccessObject objects that describe instances of all the reports in the database. For example, you can enumerate the AllReports collection in Visual Basic to set or return the values of properties of individual AccessObject objects in the collection.

You can refer to an individual AccessObject object in the AllReports collection either by referring to the item by name, or by referring to its index within the collection. If you want to refer to a specific report in the AllReports collection, it's better to refer to the item by name because the index may change.

The AllReports collection is indexed beginning with zero. If you refer to a report by its index, the first report is AllReports(0), the second report is AllReports(1), and so on.

Note Note

To list all open reports in the database, use the IsLoaded property of each AccessObject object in the AllReports collection. You can then use the Name property of each individual AccessObject object to return the name of a report.

You can't add or delete an AccessObject object from the AllReports collection.

The following example prints the name of each open AccessObject object in the AllReports collection.

Sub AllReports() 
 Dim obj As AccessObject, dbs As Object 
 Set dbs = Application.CurrentProject 
 ' Search for open AccessObject objects in AllReports collection. 
 For Each obj In dbs.AllReports 
 If obj.IsLoaded = True Then 
 ' Print name of obj. 
 Debug.Print obj.Name 
 End If 
 Next obj 
End Sub
Show:
© 2016 Microsoft