如何在表单控件中显示查询记录数 [英] How to display a query record count in a form control
问题描述
我有一个查询,它根据表单中选择的条件返回可变的记录数.我想显示返回到表单的记录总数.
I have a query that returns a fluid # of records, depending on criteria selected in the form. I would like to display the total # of records returned to the form.
我在显示控件和结果记录的表单的页脚中添加了一个未绑定的文本字段.我在文本字段中尝试了以下表达式,结果都是 #error:
I have added a unbound text field to the footer in the form that is displaying the controls and resulting records. I tried the following expressions in the text field, both of which result in #error:
=Count([qrnname]![fieldtocount])
=DCount([qrnname]![fieldtocount])
这应该很简单.
推荐答案
DCount
的参数需要字符串值.假设 fieldtocount
是命名查询 qrnname
返回的字段的名称,请将其用作文本框的 Control Source ...
DCount
requires string values for its arguments. Assuming fieldtocount
is the name of a field returned by the named query qrnname
, use this as your text box's Control Source ...
=DCount("[fieldtocount]", "qrnname")
由于该查询取决于表单中选择的条件,所以每当这些条件发生变化时,重新查询
文本框以更新文本框中显示的计数.
Since that query depends on criteria selected in the form, Requery
the text box whenever those criteria change to update the count displayed in the text box.
这篇关于如何在表单控件中显示查询记录数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!