contact@consultdmw.com

How to List All Reports in an Access Database

A VBA functions to list in the Immediate Window of its Visual Basic Editor all the reports of a Microsoft® Access database.

Last updated on 2024-05-16.


VBA Function to List All Reports

This function lists all the reports in the database in which you execute it:

Function fnDmwListAllReports() As String

On Error GoTo errHandler

Dim msg$

Dim rpt As AccessObject, dB As Object


Set dB = Application.CurrentProject

For Each rpt In dB.AllReports

Debug.Print rpt.Name

Next rpt

msg$ = "Reports listing complete"


procDone:

fnDmwListAllReports = msg$

Exit Function

errHandler:

msg$ = Err.Number & " " & Err.Description

Resume procDone

End Function


How to Run the Function

To execute the function, copy and paste the above code into a module in your database's Visual Basic Editor.

Then in its Immediate Window type ?fnDmwListAllReports and press Enter. The leading question mark is essential.


Your Support for DMW TIPS

Please support this website by making a donation to help keep it free of advertising and to help towards cost of time spent adding new content.

To make a contribution by PayPal in GBP (£ sterling) —

To make a contribution by PayPal in USD ($ US) —

Thanks, in anticipation.


Disclaimer

David Wallis does not accept any liability for loss or damage to data to which any techniques, methods or code included in this website are applied. Back up your data; test thoroughly before using on live data.

Microsoft Access Report — A database object designed to present data to the user as a ready-to-printout document