从父报告中引用子报告中的字段 [英] Referring to a field in a subreport from its parent report
问题描述
您好。
我的报告中包含许多子报告。反过来,每个子报表都包含查询中的数据,以及包含该查询中其中一列的总和的文本框。每个带有查询的子报表都有一个固定数字(3)
。
I have a report which contains a number of subreports. In turn, each of those subreports contains the data from a query, and a text box that contains the sum of one of the columns in that query. There is a fixed number (3)
of each of these subreports with a query.
在父报表上,我需要创建一个文本框,其中包含这三个子报表总和中的每一个的总和。
On the parent report, I need to create a text box that has the sum of each of these three subreport sums.
我尝试用几种不同的方式引用这个值:
I've tried referring to this value in a couple of different ways:
1。参考文本框中带有"= Reports!SubReport!TextBoxName"的文本,但这会产生"#NAME?"。错误
1. Referring to the text in the text box with "=Reports!SubReport!TextBoxName", but this results in a "#NAME?" error
2。创建Sum函数,并参考查询"Sum(SubQuery!ColumnName)",但这会返回不正确的值。具体来说,它返回查询中该列的最后一个结果。
2. Creating a Sum function, and referring to the query, "Sum(SubQuery!ColumnName)", but this returns the incorrect value. Specifically, it returns the last result in that column from the query.
汇总这些项目的最佳程序是什么?如何从子报表中引用子报表上的值?
What is the best procedure for summing these items? How do you refer to a value on a subreport, from it's parent report?
推荐答案
1。参考文本框中带有"= Reports!SubReport!TextBoxName"的文本,但这会产生"#NAME?"。错误
1. Referring to the text in the text box with "=Reports!SubReport!TextBoxName", but this results in a "#NAME?" error
嗨Anthoven,
您可以尝试:
  ;  报告(Reportname)!SubReport1!TextBoxName1 + Reports(Reportname)!SubReport2!TextBoxName2 + ...
Reports(Reportname)!SubReport1!TextBoxName1 + Reports(Reportname)!SubReport2!TextBoxName2 + ...
或
我!SubReport1!TextBoxName1 + Me!SubReport2!TextBoxName2 + ...
Me!SubReport1!TextBoxName1 + Me!SubReport2!TextBoxName2 + ...
Imb。
这篇关于从父报告中引用子报告中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!