-1

i need to create iif code for ms access, so if number count takes start from 0 and to 34 it will be F grade. Field Успішність is for count from 0-100 and field Оцінка is for grade from F (and Fx) to A. 0-34 F, 35-59 Fx, 60-63 E, 64-73 D, 74-81 C, 82-89 B, 90-100 A. numbers 0-100 is [Успішність] and grades F-A is [Оцінка].

IIf([Успішність]>=0 And [Успішність]<=34;"F";IIf([Успішність]>=35 And [Успішність]<=59;"Fx";IIf([Успішність]>=60 And [Успішність]<=63;"E";IIf([Успішність]>=64 And [Успішність]<=73;"D";IIf([Успішність]>=74 And [Успішність]<=81;"C";IIf([Успішність]>=82 And [Успішність]<=89;"B";IIf([Успішність]>=90 And [Успішність]<=100;"A";"0"))))))) it`s ChatGPT

  • Other than going to ChatGPT, what have you tried?!? What's wrong with ChatGPT result? – Marco Jul 03 '23 at 07:31
  • Field [Успішність] allowing multiple values at the same time, unacceptable in expression IIf([Успішність]>=0 And [Успішність]<=34;"F";IIf([Успішність]>=35 And [Успішність]<=59;"Fx";IIf([Успішність]>=60 And [Успішність]<=63;"E";IIf([Успішність]>=64 And [Успішність]<=73;"D";IIf([Успішність]>=74 And [Успішність]<=81;"C";IIf([Успішність]>=82 And [Успішність]<=89;"B";IIf([Успішність]>=90 And [Успішність]<=100;"A";"0"))))))) – Назар Більце Jul 03 '23 at 07:37

1 Answers1

1

Rather than starting at the bottom and working up, work from the top down:

IIf([[Успішність]>=90,"A",IIf([Успішність]>=82,"B",IIf([Успішність]>=74,"C",IIf([Успішність]>=64,"D",IIf([Успішність]>=60,"E",IIf([Успішність]>=35,"Fx",IIf([Успішність]>=0,"F",""))))))) SQL Statement

Query Outcome

Applecore
  • 3,934
  • 2
  • 9
  • 13
  • it says "incorect argument", however, thank you – Назар Більце Jul 03 '23 at 08:53
  • I've edited the answer to include its usage in a query. How are you trying to use it? – Applecore Jul 03 '23 at 09:10
  • welp, i need to create the database with data of students (names, grade, grade in number form(0-100) and their enrollment(yes or no)). Also, if i decide to change number, for example, from 66 to 55, then grade must change from D to Fx – Назар Більце Jul 03 '23 at 09:34
  • As the grade is dependent on their score, then you should not be storing the value in a table. Either use a calculated field in a form to display it, or else use the expression in a query. – Applecore Jul 03 '23 at 09:37