【问题标题】:MS Access VBA Referring to controls on a sub report using 'with'MS Access VBA 使用“with”引用子报表上的控件
【发布时间】:2018-06-20 19:52:40
【问题描述】:

使用 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"

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

【问题讨论】:

    标签: vba ms-access with-statement subreports


    【解决方案1】:

    考虑Reports 集合和Report.Controls 属性,它们允许对象名称的字符串引用:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-15
      • 2016-10-04
      • 1970-01-01
      • 2017-02-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多