running count query

ypma

Registered User.
Local time
Today, 13:34
Joined
Apr 13, 2012
Messages
643
Seasonal Greeting to One and All. Advise is sort , i have a simple query which counts the source field that have been grouped .
SQL View #SELECT Count(TblDemoData.ID) AS CountOfID, TblDemoData.Source
FROM TblDemoData
GROUP BY TblDemoData.Source;#

This work just fine, however when i tried to add a running total column i fail to get the result required IE. running total of the count field .

#SELECT Count(TblDemoData.ID) AS emp, TblDemoData.Source, DSum("[Id]","[TblDemoData]","[ID] <= " & [emp] & " ") AS RunTot
FROM TblDemoData
GROUP BY TblDemoData.Source;#

I will attach a demo to illustrate my problem , Is the fact that i am combining a count and d sum in the same query , could be causing the error.

Any guidance would be appreciated.

Regards Ypma
 

Attachments

Is this what you're looking for?

SELECT Count(TblDemoData.ID) AS emp, TblDemoData.Source, DCount("*","[TblDemoData]","[source] <= '" & [source] & "'") AS RunTot
FROM TblDemoData
GROUP BY TblDemoData.Source
ORDER BY TblDemoData.Source;
 
Paul , the dCount did the trick, thank you very much.

Bob
 
Happy to help Bob.
 

Users who are viewing this thread

Back
Top Bottom