title: Access updating field to NULL value on error condition of IIF(IsError())
body: <p>I am trying to update a table in MS Access using the following query:</p>
  
  <pre><code>UPDATE [Stock Detail Item] 
  SET [Stock Detail Item].Total_Payments =
  IIF(
    IsError(DSum("Payment_Amount", "Principal Payments", "Stock_No='" &amp; [Stock Detail Item].Stock_No &amp; "'")),
    CCur(0),
    DSum("Payment_Amount", "Principal Payments", "Stock_No='" &amp; [Stock Detail Item].Stock_No &amp; "'")
  );
  </code></pre>
  
  <p>When there are payments for the <code>Stock_No</code> in the <code>Principal Payments</code> table, the query correctly inserts the total payment amount into the table.  </p>
  
  <p>But when there are no payments in the <code>Principal Payments</code> table, the <code>IsError</code> function should return <code>True</code>, which means the <code>IIF</code> should return <code>0</code> cast to currency.  </p>
  
  <p>The problem is, the query is inserting <code>NULL</code> in these instances.  This is causing errors later down the line when trying to perform math to the <code>NULL</code> value.</p>
  
  <p>I have tried this with and without casting <code>0</code> or <code>0.00</code> to the currency data type, with no luck.  </p>
  
  <p>Any idea why this returns the correct value when no error is present, and <code>NULL</code> value when there is an error?</p>