Can you use case expressions in Access? I’m trying to determine the max date form 2 columns but keep getting syntax errors in the following code:
CASE
WHEN dbo_tbl_property.LASTSERVICEDATE > Contour_dates.[Last CP12 Date]
THEN dbo_tbl_property.LASTSERVICEDATE
ELSE Contour_dates.[Last CP12 Date]
END AS MaxDate
You can use the
IIF()function instead.conditionis the value that you want to test.valueiftrueis the value that is returned if condition evaluates to TRUE.valueiffalseis the value that is returned if condition evaluates to FALSE.There is also the
Switchfunction which is easier to use and understand when you have multiple conditions to test: