Connecting Tech Pros Worldwide Help | Site Map

**Instead of an IIF statement...

Newbie
 
Join Date: Jul 2009
Posts: 3
#1: Jul 15 '09
I am building a database in Access 2003 with a included scorecard. In the scorecard, i am atttempting to offer a grade on the bottom, based on a relevant percentage. I will refer to this percentage as X. I have built another Table, which has three columns, grade name, lower limit, and upper limit. When X falls between lower limit and upper limit, I would like the query to generate the relevant grade name on that respective record. Is this possible? Heres an example.

Grade Name Lower Limit Upper Limit
Level 0 0% 5%
Level 1 5.01% 10%
Level 2 10.01% 15%

Therefore, if X = 7%, I would like the query to generate Level 1.

I know this can be done with an if statement, however I would like the users to be able to modify this table above as they see fit, making modification simple. Any help would be appreciate.
Member
 
Join Date: Dec 2007
Posts: 47
#2: Jul 16 '09

re: **Instead of an IIF statement...


Shouldn't this be on the Access forum?
Newbie
 
Join Date: Jul 2009
Posts: 3
#3: Jul 16 '09

re: **Instead of an IIF statement...


It may be, I apologize I am new to this forum. Could you point me in the right direction as in where to find it? Thanks
Member
 
Join Date: Dec 2007
Posts: 47
#4: Jul 16 '09

re: **Instead of an IIF statement...


http://bytes.com/topic/access/answers/
Newbie
 
Join Date: Jul 2009
Posts: 3
#5: Jul 16 '09

re: **Instead of an IIF statement...


I looked through the Access forum, but I cannot find the appropriate thread. There is over 500 though, so I may have missed it. Could anyone just give me an idea of how I would go about trying to accomplish this? I would really appreciate it.
Member
 
Join Date: Dec 2007
Posts: 47
#6: Jul 16 '09

re: **Instead of an IIF statement...


In mysql I would left join the grades onto the scorecard table using a where statement to join the appropriate grade onto each of the scord card rows. Then also add to the where statement to select the relevant scorecard row.

So if your scorecard table had playerID and score fields and your grades had as you said. To select the grade of the player with ID "12" I would do...

Expand|Select|Wrap|Line Numbers
  1. SELECT gradeName FROM scorecard LEFT JOIN grades WHERE (scorecard.score <= grades.LowerLimit) AND (scorecard.score >= grades.UpperLimit) AND scorecard.playerID = 12
But thats my mysql solution, for the access one you will have to post on the access forum i gave you above.
Reply

Tags
access, access 2003, database, ms access