MS Access VBA 使用 'with' 引用子报表上的控件

MS Access VBA Referring to controls on a sub report using 'with'

使用 MS Access VBA 以下代码适用于我:

Reports.PARENT_REPORT_NAME.CHILD_REPORT_NAME.Report.Label1.Caption = "Yes"

然而这不是:

With Reports(PARENT_REPORT_NAME)
.CHILD_REPORT_NAME.Report.Label1.Caption = "Yes"

请问有人对我有什么见解吗?

考虑允许对象名称的字符串引用的 Reports collection and Report.Controls 属性:

With Reports("PARENT_REPORT_NAME")                
   .Controls("CHILD_REPORT_NAME").Report.Label1.Caption = "Yes"
   ...
End With