have to generate a rolling sum or Cumulative sum of the OIL field for each WELLNMBR as per its MONTH value.
The query used is
Code:SELECT tblProductionData.WELLNMBR, tblProductionData.[Month], tblProductionData.DAYS, tblProductionData.OIL, tblProductionData.GAS, tblProductionData.WATER, DSum("[OIL]","tblProductionData","WELLNMBR=" & "'" & [WELLNMBR] & "'" & "AND MONTH <=" & "#" & [MONTH] & "#") AS Expr2
Code:FROM tblProductionData;
In the result the sum changes after every year, not after a month. I would like to know the reason for this strange behavior and the method to obtain the rolling sum in every month.
Incorrect result
Correct result