Return the sum of values from a specified set of records.

      Dsum ( expression, domain, [criteria] )

      =DSum("[Field]", "Table", "[Field] = 'MyValue'")

   expression The field to return.

   domain     The set of records, a table or a query name.

   criteria   Equivalent to an (optional) WHERE clause.
              Any field that is included in criteria must
              also be a field in domain.

For numerical criteria use "abc=Num"
for strings use "abc='string'"
for dates use "abc=#date#"

The DSum() function can be used in VBA or in an SQL query.


DSum("price", "T_Orders", "SupplierID = 64 ")

This is equivalent to:
SELECT Dsum([T_Orders].price)
FROM [T_Orders]
WHERE (([T_Orders].SupplierID)=64);

“The most important thing in an argument, next to being right, is to leave an escape hatch for your opponent, so that he can gracefully swing over to your side without too much apparent loss of face” ~ Sydney J. Harris


Sum (SQL) - Add up the values in a query result set

© Copyright SS64.com 1999-2016
Some rights reserved