Preforming calculations in query

  • Thread starter Thread starter Judy
  • Start date Start date
J

Judy

Can someone help me with a formula I am having trouble with. I need to
create calculations that are immediately entered into a datasheet. Here is
the problem are the fields:
Week No
Score
Game Handicap

I need to count the previous 4 weeks, take the total score of those 4 weeks,
divide the total by 4, and this becomes the handicap. I want the handicap
to be immediately updated in the datasheet after the user has entered all
the about 3 fields. I tried to make an expression but I can't get it right
in my mind on the query
 
I would first create a query that selects only the top 4
records sorted by week descending. I'm assuming that
there are more than four weeks of scores in the
table. "Select top 4 * order by [Week No] desc". Then I
would add a footer to your datasheet form with a text box
with the control set to "=Sum([Score])/4". This will only
make sense if there are at least 4 weeks of scores in the
table. This solution would display the current handicap at
any given time. If you want to store the handicap to the
table for each week additional work would be needed, but
generally speaking calculations should not be stored.
Hope this helps,
steve
 
Back
Top