本文介绍了动作查询中的错误求和...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试通过动作查询添加记录集中先前值的总和 - 总和不正确


我想要这样的表名为Test:


Field1,MySumField


测试,1

测试,2

测试,3

测试,6

测试,12

我还有其他桌子这样的行......


Field1

测试,1

使用这些表我正在使用这个SQL:


INSERT INTO Test(Field1,MySumField)

SELECT Field1,IIF(Dsum(" MySumField"," Test","")> 0,Dsum( MySumFiel d,Test,,1)FROM Rows;


并且没有获得想要的结果..


好​​的工作人员喜欢开始trans和commit trans被关闭hein ..

解决方案




你不要给出第二个字段的fieldName所以我称之为Field2


Field1

测试,1


你没有通过当前的Field2值增加MySumField。


INSERT INTO测试(Field1,MySumField)

SELECT Field1,IIF(Dsum( MySumField,Test,"> 0,Dsum(MySumFiel d,Test,"+ Field2,1)FROM Rows;


When I try to add by action query the sum of the previous values in the recordset - the sum isn''t correct

I want table like this named Test:

Field1, MySumField

Test, 1
Test, 2
Test, 3
Test, 6
Test, 12

I''ve other table Rows like this...

Field1
Test, 1

And using those tables i''m using this SQL:

INSERT INTO Test (Field1, MySumField)
SELECT Field1, IIF(Dsum("MySumField","Test","")>0,Dsum("MySumFiel d","Test",""),1) FROM Rows;

And the wanted result isn''t obtained..

Well staff like begin trans and commit trans are turned off hein..

解决方案



You don''t give the fieldName of the second field so I''m calling it Field2

Field1
Test, 1

You haven''t incremented the MySumField by the current Field2 Value.

INSERT INTO Test (Field1, MySumField)
SELECT Field1, IIF(Dsum("MySumField","Test","")>0,Dsum("MySumFiel d","Test","") + Field2,1) FROM Rows;


这篇关于动作查询中的错误求和...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 04:16