This line works:
QueryString = "SELECT EquipmentMasterReadings.Equipment_Number, Max(EquipmentMasterReadings.Reading) AS CurrentMonthEnding, reading_date FROM EquipmentMasterReadings GROUP BY EquipmentMasterReadings.Equipment_Number, reading_date HAVING reading_date >= " & "'" & PassedDate & "'" & " AND reading_Date <= " & "'" & PassedDateEnd & "'" & " ORDER BY EquipmentMasterReadings.Equipment_Number, Max(EquipmentMasterReadings.Reading);"
Get Error on following line: "Incorrect syntax near '<'."
QueryString = "SELECT LubeTransactions.Equipment_Number, Sum(LubeTransactions.Quantity) AS SumOfQuantity, LubeTransactions.Lube_Type, Sum(IIf([Oil_Change]<>" & "'" & "Yes" & "'" & ",[Quantity],Null)) AS 40wt, Sum(IIf([Oil_Change]=" & "'" & "Yes" & "'" & ",[Quantity],Null)) AS oilchange FROM FuelConsumptionTemp WHERE Transaction_Date >= " & "'" & PassedDate & "'" & " AND Transaction_Date <= " & "'" & PassedDateEnd & "'" & " GROUP BY LubeTransactions.Equipment_Number, LubeTransactions.Lube_Type HAVING LubeTransactions.Lube_Type = " & "'" & "Engine Oil 40WT" & "'" & " ORDER BY LubeTransactions.Equipment_Number;"
|