Printing Record Source for a List of Reports

J

Jim Pockmire

I have a table containing a list of reports in an mdb. How can I loop
through the list, printing the record source for each report?
 
F

fredg

I have a table containing a list of reports in an mdb. How can I loop
through the list, printing the record source for each report?

To get the record =source for all of the reports in the Db:
1) Tools + Analyze + Documenter

2) or.. in a Module:

Public Sub ShowRecordsource()
' Print out the RecordSource for each report.
Dim doc As Document
Dim db As DAO.Database
Set db = CurrentDb
For Each doc In db.Containers("Reports").Documents
DoCmd.OpenReport doc.Name, acViewDesign, , , acHidden
Debug.Print "Report Name: " & doc.Name
Debug.Print "Record Source: " & Reports(doc.Name).RecordSource
Debug.Print
DoCmd.Close acReport, doc.Name
Next doc
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top