DSum 返回行数而不是总值
我将以下代码附加到表单中的文本框:
=DSum("[subform].Form![POINTS]","ATTENDANCE","[subform].Form![EMPLOYEE NO] = [EMPLOYEE NO]")
理想情况下,这将产生我们当前正在搜索的员工所获得的总积分。但是,我得到的是表中行的总和。
有人知道如何获得值的总和而不是行数吗?
谢谢
I have the following code attached to a text box in a form:
=DSum("[subform].Form![POINTS]","ATTENDANCE","[subform].Form![EMPLOYEE NO] = [EMPLOYEE NO]")
Ideally this would yield the total amount of points accrued by the employee we are currently searching for. However, what I am getting is the total sum of rows in my table.
Does anybody have any idea of how I could get the total sum of the values instead of the number of rows?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想从子表单中获取总计,并且子表单与主表单同步,则按以下方式进行会更有效:
=subform!form!txtTotalPoints
这通常会快得多。
If you want to get the total from a subform, and your subform in in sync with the main one, it will be much more efficient to procede this way:
= sum(Points)
in the footer of your subform=subform!form!txtTotalPoints
That will generally be much faster.
据我所知,DSum、DLookup、DCount 等域函数用于从表中查找并返回值。第一个参数是字段,第二个参数是表,第三个参数是确保获得正确记录集的条件或 WHERE 语句。您的第一个参数指的是表单的字段。我认为这是不正确的。 WHERE 语句中的第一项也是表单字段。我这这也是不正确的。你需要尝试这样的事情:
As far as I know, the Domain functions such as DSum, DLookup, DCount etc. are used to lookup and return values from a table. The first argument is the field, the second the table, and the third is the criteria or WHERE statement that makes sure you get the correct set of records. Your first argument refers to a form's field. I think this is incorrect. Your first item in your WHERE statement is also a form field. I this this is also incorrect. You need to try something like this instead: