Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

 
 
Microsoft Office Access
Search
Search
 
Icon: Flag: (c) Microsoft
Get up to speed
 
 
 
Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Calculate the sum of the values in a field
 

Use the Sum and DSum functions to calculate the sum the values in a field in a domain, such as a query. Use the Sum function when writing SQL statements, and the DSum 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 DSum function in an Access project (.adp).

Expression Description
Sum([Freight]) Displays the sum of the values of the Freight field.
Sum([UnitPrice]*[Quantity]) Displays the sum of the product of the UnitPrice and Quantity fields.
[Sales] / Sum([Sales]) * 100Displays the percentage of sales, determined by dividing the value of the current record's Sales figure by the sum of all the values in the Sales field.

 Note   If the control's Format property is set to Percent, don't include the "*100" portion.

DSum("[Freight]", "Orders", "[ShipCountry] = 'UK'") Displays the sum of the values in the Freight field for orders shipped to the United Kingdom. The domain is the Orders table.

Related Office Online discussions

Read related questions and answers from other Microsoft Office customers.