访问IIF语句以列出结果

问题描述 投票:1回答:1

在Access 2010中,我试图列出我的IIF语句中的结果,但由于某种原因无效。

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

这是我的清单:

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

我需要以下结果:

DogGroups - TrainingSuccess  
---------------------------  
A         - Pass  
B         - Failed  
C         - (Blank)  
D         - Failed  
ms-access ms-access-2010 iif-function
1个回答
1
投票

假设字段包含CSV文本,并且您想要的结果遵循逻辑:如果field为Null,则返回Null,否则如果字段包含“Failed”则返回“Failed”,否则为“Passed”,请考虑:

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

© www.soinside.com 2019 - 2024. All rights reserved.