ms-accessms-access-2010iif-function

Access IIF statement to list results


In Access 2010 I'm trying to list the results from my IIF statement but for some reason is not working.

DogTrainingStatus: IIf(([TrainingSuccess]>"*Pass*") And ([TrainingSuccess]>"*Failed*"),"Failed", IIf([TrainingSuccess]>"Failed","Failed"," "))

This is my list:

DogGroups - TrainingSuccess  
---------------------------  
A         - Pass, Pass, Pass  
B         - Pass, Pass, Failed  
C         - (Blank)  
D         - Failed, Failed, Failed  

I need the following results:

DogGroups - TrainingSuccess  
---------------------------  
A         - Pass  
B         - Failed  
C         - (Blank)  
D         - Failed  

Solution

  • Assuming field holds CSV text and the result you want follows logic: if field is Null, return Null, otherwise if field contains "Failed" return "Failed", otherwise "Passed", consider:

    DogTrainingStatus: IIf([TrainingSuccess] Is Null, Null, IIf([TrainingSuccess] LIKE "*Failed*", "Failed", "Passed"))