Stuart McLachlan
stuart at lexacorp.com.pg
Tue Oct 25 16:46:30 CDT 2005
On 25 Oct 2005 at 15:21, Kaup, Chester wrote:
> I have the following query to try to get a running sum with a sum each
> day. I am getting the same number each day. I probably have some simple
> syntax error but am not seeing it. Her eis the SQL.
>
> SELECT Injection.RecordDate, DSum("[Theoretical CO2] + [Theoretical
> Water]","Injection","[RecordDate]=#" & [RecordDate] & "#") AS [Cum Inj]
>
Try
SELECT Injection.RecordDate, DSum("[Theoretical CO2] + [Theoretical
Water]","Injection","[RecordDate] <= #" & [RecordDate] & "#") AS [Cum Inj]
Note the "<=" rather than "=".
You are only summing the records for RecordDate. For a running sum, you
need to sum all the records where the date is less than or equal to
RecordDate.
--
Stuart