Kaup, Chester
Chester_Kaup at kindermorgan.com
Tue Oct 25 16:51:55 CDT 2005
Thanks!! That got it. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Tuesday, October 25, 2005 4:47 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Help needed with DSum 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com