I've been trying to figure out why the following syntax returns an error and
I gave up! Could someone please look at the following and tell me what I'm
doing wrong? The goal is to get a 0 returned when the value in
q.TimesheetStatus is Null.
Thanks a lot.
Following is the syntax. The part that is causing the error is:
(IIF([q.TimesheetStatus]) Is Null,0,([q.TimesheetStatus]))
SQL = "SELECT DISTINCT u.UserID, q.WeekEnding, q.TimesheetStatus,
(IIF([q.TimesheetStatus]) Is Null,0,([q.TimesheetStatus])) FROM Users as u
LEFT JOIN (SELECT UserID,WeekEnding,TimesheetStatus from Timedetails where
WeekEnding='"&WeekEnd&"') as q ON u.UserID = q.UserID ORDER BY
q.TimesheetStatus DESC, u.UserID "
And the error I'm getting is:
Microsoft JET Database Engine error '80040e14'
Syntax error in query expression '(IIF([q.TimesheetStatus]) Is
Null,0,([q.TimesheetStatus]))'.