does acces support 'if' statements for multiple parameters?

  • Thread starter Thread starter alex
  • Start date Start date
A

alex

I am trying to prepare a grouping of already compiled data
of coursework scores. I want to group them by the
following format:
DISTINCTION >=70%
MERIT >=55% and <70%
PASS >=40% and < 55%
FAIL <40%

I tried using the IF statement but that only supports TRUE
or FALSE statements. Please help me out.

Alex
 
Are you doinf this in a query? You can put multiple criteria in a query.
You could also do multiple IF statements separated by "AND"s or you could do
nested IF statements.

You'd have to tell us where you are doing this. Query, report, SQL, vba?

Rick B
 
Take a look at the iif(.....) statement you can 'cascade these' and
accomplish you objective
but a little vb code in a code module would be much easier to maintain in
the long run
e.g.

Public function getGroup(dblScore as double) as string
select case dblScore
.......
.......take a look at the select case documentation in the hel files.
......
end case
end function

after this is built you can reference it a query

Group: getGroup([score])

Ed Warren
 
You don't give us a lot to work with here. Are Distinction, Merit, Pass,
Fail fields in a table or calculated fields in a query? What are their data
types? If they are calculated in a query, can you post the calculations?
 
As you have seen from the other replies, yes Access does
support if statements but more information about where
your are trying to do this would be appriciated but in
essance the statement would look somthing like:
iif([result]>70,"Distinction",iif([result]>55,"Merit",iif
([result>40,"Pass","Fail")))
 
Do these groupings ever change? For instance, will FAIL ever be <45 or <38?
I have rarely seen a "table" of values like this that doesn't change at some
point in the future. Perhaps a new grouping will be added or a group title
changed.

I would create a table of group ranges and then maintain data rather than
maintaining expressions or code.
 
Back
Top