求和并计算零行列表 [英] Summing and Counting a list of zero rows
问题描述
我有一个常常但并不总是有零行的表。
I have a table that often but not always has zero rows in it.
我想通过表单显示该表,并在我要显示的页脚中来自该表的数值列的总和以及记录数的计数。当表格中没有行时,这些应该为零./
I want to display that table via a form, and in the footer I want to display the sum of numerical valued column from that table and a count of the number of records. These should be zero when there are no rows in the table./
我找到的唯一方法是将其设置为是, 将"允许添加"设置为"是", 这似乎创建了一个虚拟虚拟记录,然后总和正确地归零。
The only way I've found to make it work, is to set Allow Additions to Yes, this appears to create a virtual dummy record and then the sum comes correctly to zero.
但我不想允许添加。我只想显示 - 或不在桌面上的内容。
But I don't want to allow additions. I just want to display what is - or isn't on the table.
我已经厌倦了DSUM和DCOUNT但是当表为空时没有得到任何结果。 Nz没有帮助它也没有返回null结果只是一些未定义值。
I've tired DSUM and DCOUNT but get no results when the table is empty. Nz doesn't help either it is not returning a null result just some undefined value.
推荐答案
在文本框中控制来源:
In a textbox Control Source:
= IIf(DCount(" *")> 0,DCount(" *"),0)
=IIf (DCount("*") > 0, DCount("*") , 0)
这篇关于求和并计算零行列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!