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.
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])
This should be simple.
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.
use this =DCount([fieldtocount]![qrnname])
The syntax for the DCount function is:
DCount ( expression, domain, [criteria] )
expression is the field that you use to count the number of records.
domain is the set of records. This can be a table or a query name.
criteria is optional. It is the WHERE clause to apply to the domain.
Dcount in detail
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With