title: ACCESS SQL: Nz() Function executed From VBD
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4705738/convert-null-to-zero-in-access-database">Convert Null to zero in access database</a>  </p>
  </blockquote>
  
  
  
  <p>I'm using Microsoft Visual Web Developer 2010 Express to create ASP/VB.NET page to connect with a Microsoft office Access 07. Here's my issue:</p>
  
  <p>I have this page with three drop down lists, to be used to filter a DataTable, I have this Access SQL Query that works perfectly fine in the Access, but when I try to execute the sql from VB.net an error is always showing up. "Undefined function 'Nz' in expression."</p>
  
  <p>I've reed that there could be a bug still I can't find a solution. </p>
  
  <p>VB.NET Code:</p>
  
  <pre><code>Shared Function SelectFilterWomen(ByVal tTypeCode As Integer, ByVal bBrandCode As Integer, ByVal sSize As Integer) As DataTable
      Dim Command As New OleDbCommand()
      Command.CommandText = "QUERY;"
      Command.Connection = DB.Conn()
      Command.Parameters.AddWithValue("@tTypeCode", tTypeCode)
      Command.Parameters.AddWithValue("@bBrandCode", bBrandCode)
      Command.Parameters.AddWithValue("@sSize", sSize)
      Dim Table As New DataTable("FilterWomen Shoes")
      Table.Load(Command.ExecuteReader())
      Return Table
  </code></pre>
  
  <p>QUERY:</p>
  
  <pre><code>SELECT S.sShoes_ID , S.sPicture, S.sSize , S.sPrice 
  FROM ((Shoes S INNER JOIN Type T ON S.tTypeCode = T.tTypeCode)
  INNER JOIN Brand B ON S.bBrandCode = B.bBrandCode) 
  WHERE S.tTypeCode = Nz(@tTypeCode, T.tTypeCode) 
  AND S.bBrandCode = Nz(@bBrandCode, B.bBrandCode) 
  AND S.sSize = Nz(@sSize, S.sSize) 
  AND S.sSex = 'Female' AND S.sActive = 'Y';
  </code></pre>
  
  <p>Thanks</p>