Q:

iif using Yes/No

I am having difficulty with a Yes/No field in a query.  My table has the Yes/No check box with a check or not, my query I am trying to run is...
SELECT Roster.UserID, 
EventLog.Type, 
EventLog.Priority, 
IIf([Priority]="Yes",[EventLog]![Date],Date()-183) AS Expr1
FROM EventLog 
INNER JOIN Roster 
ON EventLog.UserID = Roster.UserID
GROUP BY Roster.UserID, 
EventLog.Type, 
EventLog.Priority
HAVING (((EventLog.Type) Like "Att*"));

I have tried to run this as an "Expression" and as "Group by" and receive the error "Data type mismatch in criteria expression"   I am prety sure my use of the "Yes" is incorrect.  Please set me straight.

A:

Remove the quotation marks around the "Yes" -- with the quotes it thinks you have a string (text) value rather than a boolean (yes/no).
You might want to get in the habit of using True instead of Yes (and False instead of No) so that you'll be comfortable writing SQL for databases other than Access.

