title: Vba - Convert number to decimal when using SQL on Ms Access
body: <p>Trying to convert a number value to decimal, with two decimals (,00), in vba when selecting value from MS Access table.
  The Quantity column is of type number and the code Im using to format it is </p>
  
  <pre><code>Dim rstBody As DAO.Recordset
  Dim orderBodyQuery As String
  orderBodyQuery = "SELECT distinct CONVERT(Decimal(9,2), Quantity) FROM " + mainTable + " WHERE [" + uniqOrderColumn + "] = """ + order + """"
  Set rstBody = CurrentDb.OpenRecordset(orderBodyQuery, dbOpenSnapshot)
  </code></pre>
  
  <p>This results in the error:</p>
  
  <blockquote>
    <p>Undefined function 'CONVERT' in expression</p>
  </blockquote>
  
  <p>As the error describes Im guessing Im using the wrong syntax here (SQL Server) but I can't find how to do this.
  Please help</p>