运行平衡问题 [英] Problem with running balance

查看:68
本文介绍了运行平衡问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



以下代码似乎运行正常。唯一的问题是每个记录的交易的余额与前一个(子表单中的前一行)有关,而不是与记录的那个有关,因此所有余额仅由一个记录抵消。获得正确的运行平衡的任何想法?

Hi,
The following code seems to work fine. The only problem is that the balance for each recorded transaction is related to the immediately previous one (previous row in the subform) and not the one being recorded so that all balances are offset by just one recording. Any Idea for getting the correct running balance?

展开 | 选择 | Wrap | 行号

推荐答案

为了确保,记录5显示的结果是应该显示的结果记录4,记录4记录3'的结果等...


我会检查是否
CstId = Forms!F_Ledger !IDTblCustomers

返回正确的值。

- 在第6行和第7行之间插入 STOP 命令

- 代码中断后< ctrl>< g>

在即时窗格中:?CstId [输入]

(或者您可以打开本地菜单>查看>本地窗口)

在任何一种情况下,您都可以获得CstID

[F8]的值来逐步执行代码,以便您可以检查 DSUM()实际上正在提取正确的记录,不确定您的数据是如何设置的;但是,针对[CstNam]的聚合查询可能会允许您验证代码中的计算结果:
Just to be sure, the result shown for Record 5 is what should be shown for Record 4, Record 4 has Record 3''s result, etc...

Whata I would check is if
CstId = Forms!F_Ledger!IDTblCustomers
is returning the correct value.
- Insert a STOP command between lines 6 and 7
- Once the code breaks <ctrl><g>
In the immediate pane: ?CstId[enter]
(or you can open the locals Menu>View>Locals Window)
In either case you can get the value of the CstID
[F8] to step thru the code so that you can check that the DSUM() is actually pulling the correct records, not sure how your data is setup; however, an aggregate query against the [CstNam] might work to allow you to verify the calculated results in your code:
展开 | 选择 | Wrap | 行号


请不要考虑声明号。 5.只是转录错误。

CstId正在获得正确的价值。

在记录4中显示的余额实际上是应该为记录3等显示的结果。


David
Please do not consider statement no. 5. Just a mistake of transcription.
CstId is getting the right value.
The balance shown, say, in record 4 is really the result that should have been shown for record 3 etc.

David


您是否尝试过我发布的查询?

其结果与预期值相比如何?
Did you try the query I posted?
How does its results compare with the expected values?


这篇关于运行平衡问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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