Running Total

  • Thread starter Thread starter Kristen
  • Start date Start date
K

Kristen

Hello!
I have a subform F_Score in datasheet view on a Form
F_Dates. The linking field is dates. So for each date,
there is the F_Score subform and it has several boxes
including Score and Total Score. A new score is entered
several times throughout the day, and I want the Total
Score to be updated every time a new score is added. Thus
Total Score would be the new score plus the old Total
Score, Or it could be the new score plus all the Scores
for the day. I know this is probably a really simple thing
to do, but I don't know how to do this for a datasheet
which constantly has new records being added. This is such
an easy thing, and I'm making it sound more confusing than
it is. I hope you understand what I'm trying to say.

Thank you in advance!
 
Hi,

If I understand you right .. you want the total score to be shown in the
datasheet-viewed sub-form .. in that case all you need do is set the Control
Source property for the total score field to Sum([F_Score]).

This will always show the total of the F_Score fields displayed in the
datasheet.

HTH

MFK.
 
Thanks, Michael. This is working...sort of. It is
calculating the total, but updates it for all entries.

Ideally, what I would like is for it to total the first
score. Then the next total would be the first and second
score. Then the next total would be the first, second and
third score and so on. So that I can see what the total is
at each phase. What it is doing now is putting the same
number in all of the total fields.

For example, I want it to do this:

Score 10 Total 10
Score 30 Total 40
Score 50 Total 90
..
..
..

Any ideas?
-----Original Message-----
Hi,

If I understand you right .. you want the total score to be shown in the
datasheet-viewed sub-form .. in that case all you need do is set the Control
Source property for the total score field to Sum ([F_Score]).

This will always show the total of the F_Score fields displayed in the
datasheet.

HTH

MFK.


Hello!
I have a subform F_Score in datasheet view on a Form
F_Dates. The linking field is dates. So for each date,
there is the F_Score subform and it has several boxes
including Score and Total Score. A new score is entered
several times throughout the day, and I want the Total
Score to be updated every time a new score is added. Thus
Total Score would be the new score plus the old Total
Score, Or it could be the new score plus all the Scores
for the day. I know this is probably a really simple thing
to do, but I don't know how to do this for a datasheet
which constantly has new records being added. This is such
an easy thing, and I'm making it sound more confusing than
it is. I hope you understand what I'm trying to say.

Thank you in advance!


.
 
Hi,

Well .. the best I can come up with at short notice .. and not knowing very
much about your DB is .. if you keep the total score in the scores table,
then you can add a procedure, something like:

Private Sub ScoreValue_BeforeUpdate(Cancel As Integer)

Me.ScoreTotal = DSum("[ScoreValue]", "tblScores", "[Score Date] =" &
Date) + Me.ScoreValue
End Sub


to the before update event of the F_Score field .. this will add the score
just entered to the total.

The

"[Score Date] =" & Date

part is supposed to be the "Where" clause that you use to populate the
datasheet of scores.

I hope this is clear enough for you to work from :-)


MFK

Kristen said:
Thanks, Michael. This is working...sort of. It is
calculating the total, but updates it for all entries.

Ideally, what I would like is for it to total the first
score. Then the next total would be the first and second
score. Then the next total would be the first, second and
third score and so on. So that I can see what the total is
at each phase. What it is doing now is putting the same
number in all of the total fields.

For example, I want it to do this:

Score 10 Total 10
Score 30 Total 40
Score 50 Total 90
.
.
.

Any ideas?
-----Original Message-----
Hi,

If I understand you right .. you want the total score to be shown in the
datasheet-viewed sub-form .. in that case all you need do is set the Control
Source property for the total score field to Sum ([F_Score]).

This will always show the total of the F_Score fields displayed in the
datasheet.

HTH

MFK.


Hello!
I have a subform F_Score in datasheet view on a Form
F_Dates. The linking field is dates. So for each date,
there is the F_Score subform and it has several boxes
including Score and Total Score. A new score is entered
several times throughout the day, and I want the Total
Score to be updated every time a new score is added. Thus
Total Score would be the new score plus the old Total
Score, Or it could be the new score plus all the Scores
for the day. I know this is probably a really simple thing
to do, but I don't know how to do this for a datasheet
which constantly has new records being added. This is such
an easy thing, and I'm making it sound more confusing than
it is. I hope you understand what I'm trying to say.

Thank you in advance!


.
 
Back
Top