Access 2007 - 嵌套报告中的右侧总计 [英] Access 2007 - totals at right from nested reports

查看:66
本文介绍了Access 2007 - 嵌套报告中的右侧总计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个访问2007报告,其中报告的每一行都是4个季度的总计...每个季度都在自己的嵌套报告中......我现在想要在最右边有一个总计列,这加起来4个季度...有些季度可能没有记录...我该怎么做?


产品Q1 Q2 Q3 Q4总计

ABC 4 2 3 2 11

I have an access 2007 report where each line of the report is totals for the 4 quarters ... each quarter is in its own nested report ... I want to now have a totals column at the far right which adds up the 4 quarters ... some quarters may have no records ... how do I do this?

product Q1 Q2 Q3 Q4 Totals
ABC 4 2 3 2 11

推荐答案

Hi Tina,

欢迎来到字节


你是否在每个子报告中都有一个显示特定季度总数的字段?


为了解释,我假设你做了。考虑到这一点,您将使用完整引用(子报告名称+字段名称)引用每个字段,然后将值一起添加。


所以,让我们进一步假设您有以下子报表和字段名称(您需要更改这些名称以匹配您的实际报表/字段名称):
Hi Tina,

Welcome to Bytes

Do you have a field in each of the subreports that displays the total for that specific quarter?

For the sake of explaination, I''m going to assume that you do. With that in mind, you would reference each of the fields using the full reference (subreport name + field name) and then add the values together.

So, let''s further assume that you have the following subreport and field names (you would need to change these to match with your actual report/field names):
  1. 子报表名称:srptQ1;字段名称:TotalQ1
  2. 子报告名称:srptQ2;字段名称:TotalQ2
  3. 子报告名称:srptQ3;字段名称:TotalQ3
  4. 子报告名称:srptQ4;字段名称:TotalQ4



在主报表上的一个字段中,您看起来已将其命名为Totals,您将输入以下表达式: br />


In a field on the main report, which it looks like you''ve named "Totals", you would enter the following expression:

展开 | 选择 | Wrap | 行号


嗨Beacon ...感谢快速回复...我实际上没有嵌套报告中的总数...我想我可以使用未绑定控件的控制源中的报告名称/字段名称来引用(如您所示)每个字段...但是没有''似乎工作...然后我cr在其中查询了4个季度的查询,但没有连接线并在那里进行了总结...现在这似乎有效但不是如果四分之一没有记录...所以我应该尝试你的方式还是会有相同的问题? ......这让我想到了另一个问题......当总和或计数没有产生任何结果时,报告应该显示0 ...我已经尝试过使用Nz和iif ...是null但是仍然会出现错误并再次出现,我认为它是因为我的q2没有记录...任何建议......希望这有意义...谢谢,Tina
Hi Beacon ... thanks for the quick reply ... I actually don''t have totals within the nested reports ... I thought I could reference (as you''ve shown) each field using the report name/field name in the ''control source'' of an unbound control ... but that didn''t seem to work ... then I created a query with the 4 quarters queries in it but no join line and did the sums there ... now this seems to work but not if a quarter has no records ... so should I try your way or would this have the same problem? ... this brings me to another question ... the report should show a 0 when the sums or counts yield nothing ... I''ve tried using Nz and iif ... is null but keep getting errors and again, I think its because my q2 has no records ... any suggestions ... hope this makes sense ... thanks, Tina


就个人而言,在我曾经合作的数据库中,我倾向于创建一个交叉表查询,编译季度的总计,然后根据该查询基础子报表。如果你走这条路线,你实际上可以在交叉表中创建总列,那么你所要做的就是在主报表中包含对总列的引用,如下所示(名称示例):

Personally, in databases that I''ve worked with, I tend to create a Cross-Tab query that compiles the totals for the quarters, then base a subreport off that query. If you go this route, you can actually create the total column in the Cross-Tab, then all you''d have to do is include the reference to the total column in your main report like this (the names examples):

展开 | 选择 | Wrap | 行号


这篇关于Access 2007 - 嵌套报告中的右侧总计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆