title: How to feed an update stored procedure's decimal input parameter (could be null) by ADO VBA
body: <p>I am trying to create a template in Excel for customers to bulk update a SQL Server database. </p>
  
  <p>The tricky part is with a few numeric columns, for example, the one I am testing is <code>Estimated_Amt</code>. The value could be null, and I tried and still cannot figure out if when it is null, how to pass the value to fee an update stored procedure.</p>
  
  <p>Here's How I set up the parameter:</p>
  
  <pre><code>Estimated_Amt  = .Cells(iRowNo,8)
  
  If (.Cells(iRowNo, 8) = "") Then
      cmd.Parameters.Append cmd.CreateParameter("@Estimated_Amt", adVarChar, adParamInput, DBNULL.Value)
  Else
      cmd.Parameters.Append cmd.CreateParameter("@Estimated_Amt", adVarChar, adParamInput, CStr(Estimated_Amt))
  End If
  </code></pre>
  
  <p>I tried <code>AdDouble</code> and <code>AdDecimal</code> respectively, and never succeeded in catching without error the null or empty value, and with <code>AdVarchar</code>, still didn't work out correctly</p>
  
  <p>And the calling procedure part is like:</p>
  
  <pre><code>cmd.CommandText = "SP_RIBulkyUpdate @CaseNumber = " &amp;     CaseNumber &amp; ", " &amp; _
  "@Estimated_Amt = " &amp; Estimated_Amt
  </code></pre>
  
  <p>Any suggestion on setting the input parameter correctly? Thanks.</p>