Access 报告中的 If 语句可能有超过 1 个真实条件

Iff statement in Access report with possible more than 1 true condition

我想做一份可以 return 几个条件的报告。否定、肯定、取消、Negative/Dilute 或 Positive/Dilute。我写了一个带有几个条件的 IIF 语句。

=IIf([Negative]="1","NEGATIVE RESULT",
    IIf([Positive]="1","POSITIVE RESULT",
       IIf([Cancelled]="1","CANCELLED TEST",
          IIf([Negative]="1" And [Dilute]="1","NEGATIVE/DILUTE RESULT",
              IIf([Positive]=”1” And [Dilute]=”1”, POSITIVE/DILUTE
              )
          )
       )
    )
)

第一部分、中间部分和结尾都可以作为单个语句单独使用,但放在一起时将无法使用。

我做错了什么?有什么建议吗?

您可以混合使用 SwitchIIf 函数:

=Switch(
  [Negative]="1", "NEGATIVE" & IIf([Dilute]="1", "/DILUTE", "") & " RESULT",
  [Positive]="1", "POSITIVE" & IIf([Dilute]="1", "/DILUTE", "") & " RESULT",
  [Cancelled]="1", "CANCELLED TEST"
)