Sum Function (SQL Only)

See AlsovbfctSQLSumSee                 ExamplevbfctSQLSumEx>Low

Description

Returns the sum of a set of values contained in a specified field on a query.

Syntax

Sum( expr )

Remarks

The Sum function uses the following argument.

Argument        Description

 

expr                 String expression identifying the field that contains the numeric data you want to add, or an expression that performs a calculation using the data in that field.  Operands in expr can include the name of a table field, a control on a form, a constant, or a function (which can be either intrinsic but not a user-defined function or one of the other SQL aggregate or domain aggregate functions).

 

Sum totals the values in a field.  For example, you can use Sum to determine the total cost of freight charges.

The Sum function treats records that contain Null fields as having a value of 0.  The following example shows how you can calculate the sum of the Order Amount and Freight fields.

SELECT Sum([Order Amount] + [Freight]) FROM Orders