我在查询中使用iff表达式。试图运行它,但它说这错过了一个右括号,括号。但我检查了表达式。不知道缺少哪一个。谢谢!
= IIf([项目状态] ="项目请求"," 1",IIf([项目状态] ="项目章程",&#34 ; 2",IIf([项目状态] ="开始项目"," 3",IIf([项目状态] ="技术上已关闭",& #34; 4",IIf([项目状态] ="已关闭"," 5",IIf([项目状态] ="已取消",& #34; 6",IIf([项目状态] ="拒绝"," 7"," null")))
答案 0 :(得分:1)
试试这个IIF,
= IIf([项目状态] =&#34;项目请求&#34;,&#34; 1&#34;,IIf([项目状态] =&#34;项目章程&#34;,&#34 ; 2&#34;,IIf([项目状态] =&#34;开始项目&#34;,&#34; 3&#34;,IIf([项目状态] =&#34;技术上已关闭&#34;,& #34; 4&#34;,IIf([项目状态] =&#34;已关闭&#34;,&#34; 5&#34;,IIf([项目状态] =&#34;已取消&#34;,& #34; 6&#34;,IIf([项目状态] =&#34;拒绝&#34;,&#34; 7&#34;,&#34; null&#34;)))))))< / p>
您可以通过创建新表来简单地解决您的问题。
tbl_projStatus
==============
projStatus | projectCode
--------------------+---------------
Project request | 1
Project charter | 2
Started project | 3
Technically closed | 4
Closed | 5
Cancelled | 6
Rejected | 7
然后你可以使用DLookup,比如
= DLookup("projectCode", "tbl_projStatus", "projStatus = " & [Project status])