The following VB.Net code runs fine on SQL Server but gives an error on Access:
sql = "SELECT sr.itemcode, sr.itemname, SUM(CASE WHEN sr.transdate='4/14/2016' THEN sr.temunits] END) AS [Units Sold], " & _
"SUM(sr.itemunits) AS [Total Units Sold] " & _
"FROM [tblINV_SalesRecord] AS sr WHERE sr.transdate <= '4/14/2016' GROUP BY sr.itemcode, sr.itemname"
sql = "SELECT sr.itemcode, sr.itemname, SUM(CASE WHEN sr.transdate='4/14/2016' THEN sr.temunits] END) AS [Units Sold], " & _
"SUM(sr.itemunits) AS [Total Units Sold] " & _
"FROM [tblINV_SalesRecord] AS sr WHERE sr.transdate <= '4/14/2016' GROUP BY sr.itemcode, sr.itemname"
The error is:
IErrorInfo.GetDescription Failed with E_FAIL(0x80004005), -System.Data
IErrorInfo.GetDescription Failed with E_FAIL(0x80004005), -System.Data