我有一个计算列,用于检查"上次付款"退出日期不到90天。" withdrawdate"。表达:
IIf(DateDiff('d',[Last Payment],[withdrawaldate])<=90,'1')
如果我在sql视图中编辑它,它可以很好地工作。但是,如果我使用查询构建器编辑它,它会中断并说“#34;语法无效&#34;突出显示&#39; 1&#39;作为无效部分。
&#34;上次付款&#34;如果有任何差异,也是一个计算字段?
我错过了什么?
请帮忙
提前致谢!
修改
SQL视图如下:
SELECT
Book.Cause_Date,
Book.Is_Archived,
Book.Status, Book.Handover_Status,
Max(Payments.[Capture Date]) AS [Last Payment],
Withdrawaltest.ACCOUNTNO,
Withdrawaltest.WITHDRAWALDATE,
Withdrawaltest.WITHDRAWALREASON,
IIf(Abs(DateDiff('d',[Last Payment], [WITHDRAWALDATE])<=90)='1',"Yes","No") AS [Paid in 90Days],
IIf((Abs(DateDiff('m',[Cause_Date],[WITHDRAWALDATE])<=14)='1' And [Handover_Status]='3') Or (Abs(DateDiff('m',[Cause_Date], [WITHDRAWALDATE])<=9)='1' And [Handover_Status]='1'),'No','Yes') AS [Out Of Term],
IIf([Paid in 90Days]="Yes" Or [Out Of Term]="No","KEEP","DontBother") AS [Keep?]
FROM
Payments RIGHT JOIN (Book INNER JOIN Withdrawaltest ON Book.Case_Reference = Withdrawaltest.ACCOUNTNO) ON Payments.[Case Reference] = Withdrawaltest.ACCOUNTNO
GROUP BY
Book.Cause_Date, Book.Is_Archived,
Book.Status, Book.Handover_Status, Withdrawaltest.ACCOUNTNO,
Withdrawaltest.WITHDRAWALDATE, Withdrawaltest.WITHDRAWALREASON,
IIf((Abs(DateDiff('m',[Cause_Date],[WITHDRAWALDATE])<=14)='1' And [Handover_Status]='3') Or (Abs(DateDiff('m',[Cause_Date],
[WITHDRAWALDATE])<=9)='1' And [Handover_Status]='1'),'No','Yes')
ORDER BY
Max(Payments.[Capture Date]) DESC;
答案 0 :(得分:0)
首先,你的表达式缺少&#34; False&#34; IIf
的一部分:
IIf(DateDiff('d',[Last Payment],[withdrawaldate])<=90, '1', <FALSE-PART>)
其次,如果您使用德语访问,则必须使用;
代替,
来查询查询设计视图中的功能。
IIf(DateDiff('d';[Last Payment];[withdrawaldate])<=90; '1'; <FALSE-PART>)
但是在SQL视图中(&#39; s&#34; international&#34;)它是,
。