I have a table containing details of each fleet related event. It contains the date, the vehicle registration, mileage, event type (taken from 'fuel', 'check', 'service', 'defect', 'carwash', 'goods'), gallons of fuel, cost, notes.
I want to add a field that calculates the miles per gallon since the last refuelling. To do this I need to be able to find the difference between the mileage of the current record and the mileage when the car was last fuelled and divide the answer by the number of gallons now put in. I'm a bit of a novice with Access and so don't know how to call the record with the highest date less than the current record's date in which fuel was the event type and the registration number was equal to the current record's registration number. Hope that makes sense! If it's the first record I want it to say "First Time".
Now the second bit; I also want to add a field calculating the average daily mileage since the last check. That again means finding the difference between this mileage and the last mileage where the type was check and the also the difference between the dates. Can anybody help?
I want to add a field that calculates the miles per gallon since the last refuelling. To do this I need to be able to find the difference between the mileage of the current record and the mileage when the car was last fuelled and divide the answer by the number of gallons now put in. I'm a bit of a novice with Access and so don't know how to call the record with the highest date less than the current record's date in which fuel was the event type and the registration number was equal to the current record's registration number. Hope that makes sense! If it's the first record I want it to say "First Time".
Now the second bit; I also want to add a field calculating the average daily mileage since the last check. That again means finding the difference between this mileage and the last mileage where the type was check and the also the difference between the dates. Can anybody help?