Note You can't use aggregate and domain aggregate functions in a data access page. Additionally, you can't use domain aggregate functions in a Microsoft Access project (.adp).
Examples of expressions that use aggregate functions
Expression | Description |
---|---|
=Avg([Freight]) | Uses the Avg function to display the average of the values of the Freight control. |
=Count([OrderID]) | Uses the Count function to display the number of records in the OrderID control. |
=Sum([Sales]) | Uses the Sum function to display the sum of the values of the Sales control. |
=Sum([Quantity] * [Price]) | Uses the Sum function to display the sum of the product of the values of the Quantity and Price controls. |
=[Sales] / Sum([Sales]) * 100 | Displays the percentage of sales, determined by dividing the value of the Sales control by the sum of all the values of the Sales control.
Note If the control's Format property is set to Percent, don't include the *100. |
Examples of expressions that use domain aggregate functions
Expression | Description |
---|---|
=DLookup("[ContactName]", "[Suppliers]", "[SupplierID] = Forms![SupplierID]") | Uses the DLookup function to display the value of the ContactName field in the Suppliers table where the value of the SupplierID field in the table matches the value of the SupplierID control on the active form. |
=DLookup("[ContactName]", "[Suppliers]", "[SupplierID] = Forms![New Suppliers]![SupplierID]") | Uses the DLookup function to display the value of the ContactName field in the Suppliers table where the value of the SupplierID field in the table matches the value of the SupplierID control on the New Suppliers form. |
=DSum("[OrderAmount]", "[Orders]", "[CustomerID] = 'RATTC'") | Uses the DSum function to display the sum total of values of the OrderAmount field in the Orders table where the CustomerID is RATTC. |