riverwatch
New member
- Local time
- Today, 05:38
- Joined
- Jan 11, 2016
- Messages
- 5
Hello, I have a query designed to calculate gas mileage for multiple vehicles. I am working on a DLookup statement in a query to return the previous mileage value for the same vehicle in order to calculate fuel efficiency.
The following statement works to return the previous mileage value using the previous service ID (numerical):
PreviousMileage: DLookUp("[Mileage]","VehicleGasMileageQ","[ServiceID]=" & [ServiceID]-1)
However, I have multiple vehicles in the database and therefore need to add a criteria statement for the text field [VehicleID] = [Vehicle ID]. How would I add that piece to my DLookup statement?
Thank you
The following statement works to return the previous mileage value using the previous service ID (numerical):
PreviousMileage: DLookUp("[Mileage]","VehicleGasMileageQ","[ServiceID]=" & [ServiceID]-1)
However, I have multiple vehicles in the database and therefore need to add a criteria statement for the text field [VehicleID] = [Vehicle ID]. How would I add that piece to my DLookup statement?
Thank you