SELECT Mile1.strVehicle, Mile1.dtmFillingDate AS Expr1, Mile1.sngNumOfGallons, Mile1.sngOdometer AS Expr2, (Select Max(sngOdometer) from tblGasRecords Where sngOdometer < Mile1.[sngOdometer] and tblgasrecords.strvehicle = mile1.strvehicle) AS PrevMileage, [sngOdometer]-[PrevMileage] AS Elapsed, ([sngOdometer]-[PrevMileage])/[sngNumOfGallons] AS MPG
FROM tblGasRecords AS Mile1
WHERE (((Mile1.dtmFillingDate) Between [Start Date] And [End Date]))
ORDER BY Mile1.strVehicle;
|