View Full Version : Running Sum Problems


waq963
02-02-2009, 01:59 AM
Hi, I cannot seem to get this function working. I have a form where the user enters a score for a question and clicks next and then does the same again. So i want the running total of these to appear while im doing the questionnaire and appear in a seperate textbox called total. I can't seem to get the SQL right and also i don't know what sub to put the code in. Would really appreciate some help. Thanks.
SELECT tblAnsweredQ.Score Sum(tblAnsweredQ.Score) AS Tot
Format(DSum("Score","tblAnsweredQ" =" & [txtTotal] & "") AS RunTot
FROM AnsweredQ

This is what i had but i have no idea of the correct kind of syntax.

ACMAIN_CHM
02-02-2009, 05:16 AM
maybe you can try this SQL as below

SELECT tblAnsweredQ.Score Sum(tblAnsweredQ.Score) AS Tot
Format(DSum("Score","tblAnsweredQ" =" & [txtTotal] & "") AS RunTot
FROM tblAnsweredQ

Pat Hartman
02-02-2009, 10:24 AM
You don't need to run a separate query. Add a footer to the form and add a text box with the ControlSource of:

=Sum(Score)

It will be updated after each new record is added or updated.