Access 2007运行减法?
我知道 access 有一个正在运行的附加功能。但我怎样才能对报告进行连续减法呢?我已经用尽了所有的出路,但我无法弄清楚。
I know access has a running addition. but how can i possibly do a running subtraction on a report? I've exhausted all my outlets and I cannot figure it out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要有几个隐藏的控件。
首先,在报告的标题中,使用 DSum() 获取所有记录的总计。这将是一个带有 ControlSource 的控件,如下所示:
您可能需要为此提供第三个参数,这将是一个 WHERE 子句(不带 WHERE)。
控件的名称类似于
txtTotal
。现在,在报告的详细信息上放置两个未绑定的控件。将第一个 ControlSource 设为要总计的字段,并适当设置其 Running Sum 属性(Over All 或 Over Group,具体取决于报表的设置方式)。将此控件命名为类似于
txtRunningSum
的名称,并将其 .Visible 属性设置为 FALSE。现在,在最后一个控件中,分配此 ControlSource:
这应该可以解决问题 - 您将拥有一个控件,可以从总和中减去运行总和,并给出递减的运行总和。
You'll need to have several hidden controls.
First, in the report's header, use a DSum() to get the total of all your records. That would be a control with a ControlSource something like this:
You may want to provide the third argument for that, which would be a WHERE clause (without the WHERE).
Name that control something like
txtTotal
.Now, drop two unbound controls on the detail of your report. Make the first one's ControlSource the field you're totalling and set its Running Sum property appropriately (Over All or Over Group, depending on how your report is set up). Name this control something like
txtRunningSum
, and set its .Visible property to FALSE.Now, in the last control, assign this ControlSource:
That should do the trick -- you'll have a control that subtracts the running sum from the overal total and gives you a descending running sum.
作为替代方案,考虑简单地将您的值乘以 -1 并继续使用正常的运行总和方法...
As an alternative, consider simply multiplying your value by -1 and continue to use normal running sum methods...