Search code examples
ms-accesssyntax-erroriif

MS Access IIf Function


I have a calculated field on a table at MS Access and I'd like to use the following syntax, but it returns a syntax error pop-up and and I'm wondering which part is wrong. Could you please help with this? Thanks a lot.

IIf([Letter_Grade]="A+",4,IIf([Letter_Grade]="A",4,IIf([Letter_Grade]="A",3.7,IIf([Letter_Grade]="B+",3.3,IIf([Letter_Grade]="B",3,IIf([Letter_Grade]="B",2.7,IIf([Letter_Grade]="C+",2.3,IIf([Letter_Grade]="C",2,IIf([Letter_Grade]="C",1.7,IIf([Letter_Grade]="D+",1.3,IIf([Letter_Grade]="D",1,IIf([Letter_Grade]="D-",0.7,IIf([Letter_Grade]="F",0)))))))))))))


Solution

  • Try adding ",null" after your last expression:

    IIf([Letter_Grade]="F",0,null)))))))))))))
    

    Though it may be better to use a query?