This procedure finds all the Reports in an MS Access Database. This shows how many reports are in the database and prints out the source of each report. In order to print the source of each report, the report is opened in design mode.
Public Sub AllReports()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllForms collection.
MsgBox dbs.AllReports.Count
For Each obj In dbs.AllReports
'If obj.IsLoaded = True Then
' Print name of obj.
' Debug.Print obj.name & vbNewLine & "--------------"
' For Each prop In obj.Properties
' Debug.Print vbTab & prp.name & " = " & prp.Value
' Next
DoCmd.OpenReport obj.Name, acViewDesign
Debug.Print obj.Name & " RecordSource -" & Reports(obj.Name).RecordSource
DoCmd.Close acReport, obj.Name
'End If
Next obj
End Sub
This is a complimentary article written by the MAARS team for the MAARS user community. Code in this article drives the operation of MAARS (MS Access Application wRiting Software). MAARS is an intelligent automation program that speeds up MS Access Application Development by 10x, 20x or 100x times. To learn more about MAARS, click here.
Disclaimer:
Some information included in this article may have been sourced from other publicly available websites and blogs. In such cases, credit goes to those authors for the original ideas and thoughts, but we do take credit for putting valuable information together and improve the efficiency of other office developers.