You can use the DCount function. Put this in the text boxes control
source.
=DCount([FieldName], TableName, [Criteria])
or without criteria.
=DCount([FieldName], TableName) It can also be a query name instead
of table name.
If you want one form to count the totals from two different tables and
combine them then you could use.
=DCount([FieldName], TableName1)+DCount([FieldName], TableName2)
DCount(expr, domain, [criteria])
The DCount function has the following arguments.
Argument Description
expr - An expression that identifies the field for which you want to
count records. It can be a string expression identifying a field in a
table or query, or it can be an expression that performs a calculation
on data in that field. In expr, you can include the name of a field in
a table, a control on a form, a constant, or a function. If expr
includes a function, it can be either built-in or user-defined, but not
another domain aggregate or SQL aggregate function.
domain - A string expression identifying the set of records that
constitutes the domain. It can be a table name or a query name for a
query that does not require a parameter.
criteria - An optional string expression used to restrict the range of
data on which the DCount function is performed. For example, criteria
is often equivalent to the WHERE clause in an SQL expression, without
the word WHERE. If criteria is omitted, the DCount function evaluates
expr against the entire domain. Any field that is included in criteria
must also be a field in domain; otherwise the DCount function returns a
Null.
Are your tables linked in any fashion?
Thanks Grumby!
Do you know how I would be able to refer it to a different table? I am
using Two tables and I would like the one form to count the number of
entries on both of them.
Thanks
Colin
gumby wrote:
You could place a text field on your form and in the control source put
=count(*)
or
=count([FieldName]) - A field name that shows up on every record, like
the primary key.
(e-mail address removed) wrote:
Hi there
On the bottom of forms you can select to have the "counter" showing how
many entries are on a table. Is there any way of getting this amount
listed in a text box instead?
Thanks
Colin