开发者

Access 2007 running subtraction?

开发者 https://www.devze.com 2023-02-28 07:41 出处:网络
I know access has a running addition. but how can 开发者_如何学Ci possibly do a running subtraction on a report? I\'ve exhausted all my outlets and I cannot figure it out.You\'ll need to have several

I know access has a running addition. but how can 开发者_如何学Ci possibly do a running subtraction on a report? I've exhausted all my outlets and I cannot figure it out.


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:

  =DSum("Price","tblInventory")

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:

  =[txtTotal]-[txtRunningSum]

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.


As an alternative, consider simply multiplying your value by -1 and continue to use normal running sum methods...

0

精彩评论

暂无评论...
验证码 换一张
取 消