title: MS access iif statement
body: <p>I'm building a report in MS Access and got stuck on something. Basically what I'm doing is making a report that will display a list of clients on particular days. At the bottom of the report i do a total for Client count with this statement...</p>
  
  <pre><code>=(Sum([numclientsM]) &amp; " M ; " )
  </code></pre>
  
  <p>Below that I'm trying to take an average for all reported days but i keep getting a weird error saying "CANNOT HAVE AGGREGATE FUNCTION IN EXPRESSION (AVG(SUM([numclientsM]))).</p>
  
  <p>Here's what I'm trying to do here... Check if sum(numclientsM) is &lt;> 0 then, if it is then give me average:</p>
  
  <pre><code>=IIf(Sum([numclientsM]&lt;&gt;0),Avg(Sum([numclientsM])),"0.0")
  </code></pre>