How to display subreport name while viewing main report in design view?

  • Thread starter Thread starter ATL10SPRO
  • Start date Start date
A

ATL10SPRO

Hello Everyone,

Your assistance is greatly appreciated.
I am using MS Access 2003.

Let's say we created a new report using design view. We'll call the
report "Mtg. Agenda". The "Mtg. Agenda" report has several subreports
which were added using the subform/subreport icon available under the
toolbox. For "Source Object", I am pointing to another report I have
already created. I have added 12 additonal subreports to the main
report "Mtg. Agenda". Is there a global setting I can select to
display ALL source objects, associated with the subreports I added,
while I am in viewing the main report "Mtg. Agenda" in design view?

The only way I can do it is to individually select each label for the
subreport; Mouse-right-click on a control "attached" to the lower left
side of the label to get a pop up menu which has the option "Subreport
in New Window". After selecting the option "Subreport in New Window",
a new window comes up displaying the subreport in design view. When I
close the new window displaying the subreport, the main report "Mtg.
Agenda" in design view is updated to show the name of the object source
associated with the label for the subreport I had selected to get the
pop up menu with the option "Subreport in New Window". The design view
for "Mtg. Agenda" now shows:

Items for Review <---This is the label for the subreport
Report.items-for-review <---Source object associated with the label
(subreport)

How can I globally displayed the names of ALL the source objects
associated with all the subreports without having to use "Subreport in
New Window" individually for each subreport?

Thank you!

Edwin
 
Hi Edwin

If you click on the border of a subform/subreport in design view, so long as
the subform/report is not currently selected, you will select the container
control. In the property sheet for that control you will see SourceObject,
along with all the other properties of the container control.

You can also select the subreport container control from the dropdown list
object selector on the design toolbar.

If you really want to see all of them in one place, then you need to write
some code. Something like this should work:

Public Sub ListSourceObjects()
Dim rpt As Report, ctl As Control, s As String
For Each rpt In Reports
If rpt.CurrentView = 0 Then
s = s & "Report: " & rpt.Name & vbCrLf
For Each ctl In rpt.Controls
If ctl.ControlType = acSubform Then
s = s & " " & ctl.Name & " : " & ctl.SourceObject & vbCrLf
End If
Next
End If
Next
MsgBox s, , "Source objects"
End Sub
 
Thank you **very much** Graham. I will do it programmatically as you
suggested. Thank you for the code! Edwin
 
Back
Top