Access: Count Function

In Access, the Count function calculates the number of records in a select query.

The syntax for the Count function is:

Count ( expression )

The required expression argument represents a string expression identifying the field that contains the data you want to count or an expression that performs a calculation using the data in the field. Operands in expression can include the name of a table field or function (not other SQL aggregate functions). You can count any kind of data, including text. The Count function doesn’t count records that have Null fields unless expression is the asterisk (*) wildcard character. If you use an asterisk, Count calculates the total number of records, including those that contain Null fields.

SQL query

In Access, you can use the Count function in the query design grid, in an SQL statement in SQL view of the Query window, or in an SQL statement within Visual Basic code. It is used in conjunction with the Group By clause.

SELECT SellerID, Count(Item) AS Quantity
FROM Antiques


Leave a Reply

Your email address will not be published.