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
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)
This results in the error:
Undefined function 'CONVERT' in expression
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
Format([Quantity], "0.00"). To retrieve numeric values rounded by 4/5 to two decimals, it would be:CCur(Format([Quantity], "0.00")). To set the Format property, use: "0.00", or just "Standard".