davidzxc574
davidzxc574

Reputation: 481

Access how to show record count of a table on a form

I want to show a variable value (record count of a table) on an Access form. I tried with a textbox by defining its control source with the following and many other internal functions but all returned only errors. Anyone can help? Thanks

select count(*) from TableName

Upvotes: 1

Views: 5633

Answers (2)

Lee Mac
Lee Mac

Reputation: 16015

I would also suggest the DCount domain aggregate function as suggested by Andre, but to offer an alternative, if TableName is the Record Source for your form, you can also use:

=Count(*)

To count all records in the Record Source, or:

=Count([FieldName])

To count all non-null values of a particular field in the Record Source.

Upvotes: 1

Andre
Andre

Reputation: 27634

You need = and domain functions.

=DCount("*", "TableName")

should work as control source.

Upvotes: 1

Related Questions