Home > Back-end >  MS Access IIf Function
MS Access IIf Function

Time:01-28

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)))))))))))))

CodePudding user response:

Try adding ",null" after your last expression:

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

Though it may be better to use a query?

CodePudding user response:

The function works well, did you put = operator before it.

Attached are some images of the results I got and the function

Design view

B

A

A-

A

  •  Tags:  
  • Related