您通常可以使用 VBA 轻松发现错误,因此:
IIf([START DATE] < DateSerial(Year(Date),[WinterStartMonth],[WinterStartDay]) _
And [START DATE] > DateSerial(Year(Date),[SummerStartMonth],[SummerStartDay]), _
DateAdd("d", [WinterInspectionDropDead], [START DATE]), DateAdd("d", _
[SummerInspectionDropDead], [START DATE]))
只需删除 SQL 的换行符:
IIf([START DATE] < DateSerial(Year(Date), [WinterStartMonth], [WinterStartDay])
And [START DATE] > DateSerial(Year(Date),[SummerStartMonth], [SummerStartDay]),
DateAdd("d", [WinterInspectionDropDead], [START DATE]),
DateAdd("d", [SummerInspectionDropDead], [START DATE])) As Result
或者可能更好:
IIf([START DATE] < DateSerial(Year(Date), [WinterStartMonth], [WinterStartDay])
And [START DATE] > DateSerial(Year(Date),[SummerStartMonth],[SummerStartDay]),
[START DATE] + [WinterInspectionDropDead],
[START DATE] + [SummerInspectionDropDead])
As Result