Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to tell if a report uses sub reports? 1

Status
Not open for further replies.

egstatus

Programmer
Apr 14, 2005
143
0
0
US
Is there a way to find out if a report uses sub reports?
I have a sub report that I modified but I need to know what reports use it. [Without having to open each report in the reports object]

I was thinking that there may be a way to iterate through each report and print its children (report names), but I'm not a ware if there is a way.

Thanks

Ed
 
Object dependencies may work, but I found on a really big application you will get too much additional information.
mdbdoc provides a ton of this type of information but not exactly what you are looking for.

This code will print out the answer showing where all subreports are used.
Code:
Public Sub WhereUsed()
  Dim rptObj As Access.AccessObject
  Dim rpt As Access.Report
  Dim ctl As Access.Control
 
  For Each rptObj In CurrentProject.AllReports
    DoCmd.OpenReport rptObj.Name, acViewDesign
    Set rpt = Reports(rptObj.Name)
      For Each ctl In rpt
       
        If ctl.ControlType = acSubform Then
          Debug.Print ctl.SourceObject; " is used by " & rpt.Name
        End If
        Next ctl
      DoCmd.Close acReport, rptObj.Name
    Next rptObj
        
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top