Thank you for your patience..
Well,
I just wrote a bunch of stuff but this thing logged me out and I lost it.. Short and sweet,
I get a Data type mismatch in criteria expression.(FYI, I renamed Mileage to Odometer like you did - it made more sense.) This is what my query looks like.
Column1
FIELD: VehicleAlias: VehicleNum
TABLE: TBL-Mileage
Column2
FIELD: Odometer
TABLE: TBL-Mileage
Column3
FIELD: Previous: Nz(DLast("Odometer","TBL-Mileage","[VehicleNum] < " & [VehicleAlias]),0)
Column4
FIELD: Difference: [Odometer]-[Previous]
Column5
FIELD: RunningTotal: Nz(DSum("Odometer","TBL-Mileage","[VehicleNum] <= " & [VehicleAlias]),0)
I did not enter anything in the criteria sections..
The output looks as follows:
Vehicle, CurrentMileage, Previous, Difference, RunningTotal
149, 11125, #Error, #Error, #Error
185, 2, #Error, #Error, #Error
185, 2, #Error, #Error, #Error
185, 9999, #Error, #Error, #Error
I think it may have something to do with my PK. I have Access using an autonumber and ID as the PK. Otherwise it wouldnt let me enter multiple dates using the same vehicle into the table. So I had another table called TBL-Vehicle and I am using the VehicleNum as a lookup field to that. Also this way the user cannot miskey the vehcile number. Is this logical?