Hi I am trying to convert my website from SQL to MS Access so that I can keep a functional backup in Access.
On this page, I am getting the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Wrong number of arguments used with function in query expression 'isnull(tradeprice,UnitPrice)'.
This is the coresponding area of code producing the error. (All code works perfectly in SQL, but gives this error in Access)
<%
Dim rsSpecial
Dim mstrSql
Dim rsSpecial_numRows
mstrSql = "SELECT ProductID, SubCatagoryID, ProductName, ProductPict, SpecialPrice,"
if isTradeAccount then
mstrSql = mstrSql & "isnull(tradeprice,UnitPrice)"
else
mstrSql = mstrSql & "UnitPrice"
end if
mstrSql = mstrSql & " as UnitPrice, 0 as ProductDetailID FROM Products WHERE Special = 'Yes' and ProductID not in (select ProductID from ProductDetails) union " & _
"SELECT po.ProductID, po.SubCatagoryID, po.ProductName,
pr.Pict as ProductPict, " & _
"isnull(
pr.SpecialPrice,po.SpecialPrice) as SpecialPrice,"
if isTradeAccount then
mstrSql = mstrSql & "isnull(
pr.tradeprice,
pr.UnitPrice)"
else
mstrSql = mstrSql & "
pr.UnitPrice"
end if
mstrSql = mstrSql & " as UnitPrice,
pr.ProductDetailID FROM Products po inner join productDetails
pr on po.ProductID=
pr.ProductID WHERE
pr.onSpecial = 'Yes' order by ProductDetailID, SubCatagoryID DESC"
Set rsSpecial = Server.CreateObject("ADODB.Recordset")
rsSpecial.ActiveConnection = MM_connTS_STRING
rsSpecial.Source = mstrSql
rsSpecial.CursorType = 0
rsSpecial.CursorLocation = 2
rsSpecial.LockType = 1
rsSpecial.Open()
rsSpecial_numRows = 0
%>
What should I change to get this to work?
Thanks for you help in advance,
Joe