|
Question : Microsoft Access DSum over Multiple Criteria
|
|
I am trying to get a running total using the DSum function in Microsoft Access.
My table and what I want the RunSum to look like is this: SchedID EmpNum SchedDate Hrs RunSum 11600 100 08/01/07 8 8 11601 100 08/02/07 8 16 11602 100 08/03/07 8 24 11603 200 08/01/07 8 8 11604 200 08/02/07 8 16 11605 200 08/03/07 0 16 11606 200 08/04/07 8 24
I have been trying to use the following query: UPDATE tblTimeCombined SET tblTimeCombined.HrsTot = DSum("Hrs","tblTimeCombined","[EmpNum]<= '" & [EmpNum] & "' AND [SchedID]<= " & [SchedID] & "");
This is what it does: SchedID EmpNum SchedDate Hrs RunSum 11600 100 08/01/07 8 8 11601 100 08/02/07 8 16 11602 100 08/03/07 8 24 11603 200 08/01/07 8 32 11604 200 08/02/07 8 40 11605 200 08/03/07 0 40 11606 200 08/04/07 8 48
All it does is keep the running sum going. I want a running sum for each record of the EmpNum.
SchedID is the primary key of tblTimeCombined
Any idea on how I can do this?
Thanks.
|
|
Answer : Microsoft Access DSum over Multiple Criteria
|
|
In your original query, use this criteria:
"[EmpNum] = '" & [EmpNum] & "' AND...
= and not <=
Cheers! (°v°)
|
|
|