List Reports and Associated Recordsource

D

Dave F

How can I create a function that will list all the Access reports and their
associated recordsource?
The database documenter gives too much information. I'm trying to cleanup
unused queries and tables in my database.

Thanks,
Dave F.
 
C

Chris Nebinger

Using DAO (ADO isn't much different)

Sub PrintReportRecordsource()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Select Name,Type from
msysobjects where type=-32764")
Do Until rst.EOF
DoCmd.OpenReport rst!Name, acViewDesign
Debug.Print rst!Name, Reports(rst!Name).RecordSource
DoCmd.Close acReport, rst!Name, acSaveNo
rst.MoveNext
Loop

End Sub



I didn't add any object cleanup, or error handling.



Chris Nebinger
 
Top