Use the Avg and DAvg functions to count the number of records in a domain, such as a query. Use the Avg function when writing SQL statements, and the DAvg function when writing Visual Basic for Applications (VBA) code, macros, and expressions. Note that you can't use these functions in a data access page (data access page: A Web page, published from Access, that has a connection to a database. In a data access page, you can view, add to, edit, and manipulate the data stored in the database. A page can also include data from other sources, such as Excel.). Additionally, you can't use the DAvg function in an Access project (.adp).
| Expression |
Description |
| Avg([Freight]) |
Displays the average of the values of the Freight field. |
| Avg([Total]+[Tax]) |
Displays the average of the sum of the values in the Total and Tax fields |
| DAvg("[Freight]", "Orders", "[ShipCountry] = '" & strCountry & "'AND [ShippedDate] >= #" & dteShipDate | Returns the average freight cost for orders shipped to a specified country/region (strCountry) on or after a given date (dteShipDate). The domain is the Orders table. |