Option Explicit
Sub ListReportsAndQueries()
Dim rpt As AccessObject
Debug.Print "---------REPORTS---------"
For Each rpt In CurrentProject.AllReports
Debug.Print rpt.Name
Next rpt
Debug.Print
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection
Debug.Print "---------QUERIES---------"
For Each tbl In cat.Tables
If tbl.Type = "VIEW" Then
Debug.Print tbl.Name
End If
Next tbl
End Sub
Option Explicit
Sub ListReportsAndQueries97()
Dim db As Database
Dim ctr As Container
Dim lngI As Long
Set db = CurrentDb
Set ctr = db.Containers("Reports")
Debug.Print "---------REPORTS---------"
For lngI = 0 To ctr.Documents.Count - 1
Debug.Print ctr.Documents(lngI).Name
Next lngI
Debug.Print
Dim qdf As QueryDef
Debug.Print "---------QUERIES---------"
For Each qdf In db.QueryDefs
' Probably don't want to print the hidden queries
If Left$(qdf.Name, 4) <> "~sq_" Then
Debug.Print qdf.Name
End If
Next qdf
End Sub