Check null value in SQL Access SQL statement

The following query does not return a value for CurrentVisitor in the my ms access 2010 database:

 SELECT h.ClientNumber, IIf(h.CheckoutDate=null,"Yes","") AS CurrentVisitor FROM VisitsTable AS h INNER JOIN ( SELECT ClientNumber, MAX(LastVisitDate) AS LastVisitStart FROM VisitsTable GROUP BY ClientNumber) AS t ON (h.LastVisitStart = t.LastVisitStart) AND (h.ClientNumber = t.ClientNumber); 

I think the reason is that the null check in the If() operation is spelled incorrectly. Can someone show me how to fix this?

+7
sql ms-access
source share
1 answer

Using

 Is Null 

but not

 = Null 
+13
source share

All Articles