Inconsistent Results Referencing Nested Subreport Property

Copper Contributor

I have placed several subreports in an unbound report's Report Header. Each subreport has two subreports. I'm trying to get the value of the Top property of the first of these sub-subreports, but I'm getting inconsistent results. The reference I'm (currently) using in the OnLoad event of the main report is:

intSubSubTop = Me.Controls(strSub1).Report.Controls(strSubSub1).Top

 

This works perfectly when I switch from Design View to Print View, but I get a runtime error (2455: the expression "has an invalid reference to the property Form/Report") when I open the report from the navigation pane. What's the difference between these two actions?

 

I've tried different variations to no avail. What do I need to do to make it work consistently?

 

I'm using Access 2010 on Windows 10 Pro

5 Replies
What's the difference between these two actions?

I guess the report has loaded into memory in the first case.
When opened from pane,it has not been loaded successfully.

@peiyezhu 

So should I be doing this in a different event? I thought subreports loaded before the parent report.

I believe I need my code to run before either of those events. At what point would nested subreport properties be available to the parent report?
Sorry,I can not understand your situation in detail.
I can not get what you mean :
At what point would nested subreport properties be available to the parent report.