UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Sum of all records before current record?    
 
   
KristianDude
post Feb 14 2007, 11:41 AM
Post #1

UtterAccess Guru
Posts: 518
From: Rivendell, Middle Earth



Hello UA! I have a Table linked to a subTable with items and costs. I'm wondering about the possibilities of adding up all previous records to a record currently being viewed. Kind of like a running sum up to a current record being viewed? Can this be done? (IMG:http://www.utteraccess.com/forum/style_emoticons/default/sad.gif) thanks a bunch!!!

Edited by: KristianDude on Wed Feb 14 11:44:01 EST 2007.
Go to the top of the page
 
+
KristianDude
post Feb 14 2007, 12:02 PM
Post #2

UtterAccess Guru
Posts: 518
From: Rivendell, Middle Earth



Here's what I've come up with to do what I need (mostly), but dont know how to limit it to only include records written prior:

Me.Net = Nz(DSum("[Labor]+[Material]+[Equipment]+[General])*(1+[Increase])/100)*100", "qryCOTotals", "[JobNumber] = " & Me.JobNumber), 0)

Maybe the AutoNumber or TimeStamp I have on the table could be utilized???

Thanks for any help!

Edited by: KristianDude on Wed Feb 14 12:04:18 EST 2007.
Go to the top of the page
 
+
balaji
post Feb 14 2007, 08:41 PM
Post #3

UtterAccess VIP
Posts: 5,635
From: Chicagoland, USA



You have got the right idea. Are the records ordered by a date/time field? Then you can use that in the third argument of your Dsum() to limit the sum to records before the current one. Otherwise, you have to find some field (maybe an autonumber ID field) that will identify unambiguously all the records before the current one. I think there is a running total example in the northwinds database also.
Go to the top of the page
 
+
KristianDude
post Feb 15 2007, 02:27 PM
Post #4

UtterAccess Guru
Posts: 518
From: Rivendell, Middle Earth



Balaji,

Right on! Thank you for your input! I ended up using the number assigned. Every new record has a DMax + 1 number assigned. It works great! (IMG:http://www.utteraccess.com/forum/style_emoticons/default/sad.gif)
Go to the top of the page
 
+
balaji
post Feb 15 2007, 06:10 PM
Post #5

UtterAccess VIP
Posts: 5,635
From: Chicagoland, USA



You are most welcome. Good luck with your project. (IMG:http://www.utteraccess.com/forum/style_emoticons/default/thumbup.gif)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 11:07 PM