I have a query with two tables (1 to M) I need to sum a value from the many side with totals turned on. Summing works fine [SumofAmount]. Then I am creating a profit field where a field from the parent table [Sold Price] subtracts the [SumofAmount]. But I am stuck here as I get error "enter Parameter". SQL is as under:
Will appreciate some help.
SELECT Vehicles.[VIN Number], Vehicles.Make, Vehicles.Model, Vehicles.Year, Vehicles.[Price (JYP)], Vehicles.[Price (AUD)], Vehicles.[Sold Price], Sum(tblExpenses.Amount) AS SumOfAmount, [Sold Price]-[SumofAmount] AS Expr1
FROM Vehicles INNER JOIN tblExpenses ON Vehicles.VehicleID = tblExpenses.VehicleID
WHERE (((Vehicles.SStatus) Like "*Sold*" And (Vehicles.SStatus)<>"Added to Fleet"))
GROUP BY Vehicles.[VIN Number], Vehicles.Make, Vehicles.Model, Vehicles.Year, Vehicles.[Price (JYP)], Vehicles.[Price (AUD)], Vehicles.[Sold Price], [Sold Price]-[SumofAmount];