Free Lessons Courses Seminars TechHelp Fast Tips Templates Topic Index Forum ABCD

 Home   Courses   Seminars   Templates   TechHelp   Fast Tips   Forums   Help   Contact   Join   Order   Logon More... What's New? Popular Links ------------ Access Courses Access Index Access TechHelp Access Forum ------------ Excel Courses Excel Index ------------ Code Vault Testimonials

 Home > Forums > Access
Access Forum
Darrin Hebert
3 months ago
I have a potentially uncommon problem I'm trying to solve.

Overview:
Imagine playing golf with a group of people with recurring tournaments.  There is a scoring system that awards points based on how your score compares to others.
I.E. 1st place awards 100 pts, 2nd 95, 3rd 90, and so on.

Problem:
I have solved for ranking the scores.  my challenge is on how to handle some limitations with players getting the same score and therefore getting the same rank.  (I can deal with this as is) however, for the players that get the same score, I want to calculate how points are distributed amongst them.

Rules for distribution of points when ties occur:
sum points for ranks 1,2,3... in this case 100+95+90=285, then evenly assign to each tying golfer... in this case that would give golfers 1,2,3 95 points each (285/3)... note that it is also possible for there to be other tying scores down the list (golfers 15 & 30 have a score of 40)

Ranks & Points:
1-100
2-95
3-90
4-85

Example golfer, tourn scores, ranks & points:
golfer 1, score 30, rank 1, points 100
golfer 2, score 30, rank 1, points 100
golfer 3, score 30, rank 1, points 100
golfer 4, score 31, rank 4, points 85

My SQL at this point: (which gives me a "#Error" in datasheet view (Adjustment field). I haven't gotten to the division part yet. Position=Rank

`SELECT [MajorScoreOrderingQ P2].[WGT Name], [MajorScoreOrderingQ P2].Position, (DSum("[MajorPosPts]","[MajorPtSystem]","[MajorsPosition]=[" & [Position])) AS AdjustmentFROM MajorPtSystem INNER JOIN [MajorScoreOrderingQ P2] ON MajorPtSystem.MajorsPosition = [MajorScoreOrderingQ P2].PositionGROUP BY [MajorScoreOrderingQ P2].[WGT Name], [MajorScoreOrderingQ P2].PositionORDER BY [MajorScoreOrderingQ P2].Position;`

any assistance is greatly appreciated and hopefully this doesn't constitute writing a book.
 Scott Axton 3 months ago The #Error usually is an indication that there isn't information in a field to be able to perform a calculation. See the Calculated Fields and the NZ Function videos.
 Darrin Hebert 3 months ago Hi Scott, thanks for the tip, however I believe my issue is different than assuming a zero (or some other value).  While it may be true that the #Error suggests there isn't information in the Adjustment field, I'm trying to figure out why that may be.  Because the underlying queries all return the results I'm looking for.   I believe my issue may be in the use or the way I'm using DSum. Is there anything I can share i.e. query results, table values, etc. that might aid in this troubleshooting?
 Alex Hedley 3 months ago Is this a typo: `[MajorsPosition]=[`
 Darrin Hebert 3 months ago
 Darrin Hebert 3 months ago
 Darrin Hebert 3 months ago
 Darrin Hebert 3 months ago
 Darrin Hebert 3 months ago
 Darrin Hebert 3 months ago
 Darrin Hebert 3 months ago
 Darrin Hebert 3 months ago
 Darrin Hebert 3 months ago
 Darrin Hebert 3 months ago Hi Alex, No [MajorsPosition]=[ is not a typo, it is the criteria for my DSum... specifically, I'm trying to add the points for the golfers that have the same 'Rank'.
 Kevin Robertson 3 months ago Alex is right. You have an extra bracket that isn't needed. In MajorScoreOrderingQ P3: `Adjustment: DSum("MajorPosPts","MajorPtSystem","MajorsPosition=" & [Position])`
 Alex Hedley 3 months ago Prob not a good idea having spaces in your Query names too
 Darrin Hebert 3 months ago Thanks All, appreciate your help.   I mis-understood the question regarding the typo, indeed you were correct about the extra bracket.  thanks again.
 Alex Hedley 3 months ago Sorry for being vague, I like to get you thinking :p

This thread is now closed. If you wish to comment, start a NEW discussion, below.

Start a NEW Conversation

Subscribe to Access Forum