Chapter 18: Advanced Access Query Techniques
643
FIGURE 18.6
The QBE pane of a query using the Count(*) function
The datasheet now has a single cell that shows the number of records in tblContacts
(see Figure 18.7). This query is included in the Chapter18.accdb database as
qryCountingCustomers.
FIGURE 18.7
The datasheet of a Count(*) function for tblCustomers
Because the Count() function counts the number of records returned by a query, it is the only
field that can appear in the query’s results. Although initially this may seem rather odd, there is no
way a single query can display both a count of all records, and data from the records themselves.
Because of this limitation, the Count() function is almost always used to return information
about the data in a database, rather than the data itself. After all, it is easy enough to create a sec-
ond query that returns the data counted by Count(), if needed.