A family of Microsoft relational database management systems designed for ease of use.
Your subquery only exists within the context of your query. You would have to have the subquery saved as a query in order to use it with the dcount function.
Can you post the entire query string instead of an excerpt. You might be able to get the result you want with
SELECT C.[Name]
, Abs(SUM(C.BlindYOpY = "N") as YNMatch
FROM (SELECT B.[Name], B.Y, O.Y, IIf(IsNull(B.Y) And IsNull(O.Y), Null,IIf(B.Y=O.Y,"M","N")) AS BlindYOpY...) AS C
GROUP BY C.[Name]
If you prefer you can use a different expression to get the count. Count counts the presence of a non-null value, so return null if the comparison expression is false and any value you want if the comparison expression is true.
, Count(IIF(C.BlindYOpY = "N",1,Null)) as YnMatch
John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County