Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cumulative totals in MS Access

Status
Not open for further replies.

terry3948

IS-IT--Management
Nov 12, 2006
8
US
I am trying to establish a column on a monthly report that will show the accumulated totals for each row by counting from the previous months to the present month without projecting into future months. Also the accumulated data should only count the current year. The basic concept of the simple =Sum([data]) works for the current month, however I am obviously missing a piece of the formula to get the accumulation for the previous months. Anyone had any experience with this? Any help appreciated.
 
Apparently you want to pull details from a current time period with totals from a previous time period. If this is the case, you might want to use a union query. For instance, if you were reporting the Freight by CustomerID from the Northwind sample database and wanted to total the Freight prior to 1/1/1997 and display the details between 1/1/1997 and 1/31/1997:
Code:
SELECT Orders.CustomerID, Null as OrderDate, Sum(Orders.Freight) as SumPrevFreight
FROM Orders
WHERE OrderDate < #1/1/1997#
GROUP BY CustomerID
UNION  ALL
SELECT Orders.CustomerID, Orders.OrderDate, Orders.Freight
FROM Orders
WHERE OrderDate Between #1/1/1997# And #1/31/1997#;

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top