What is recorded in TDate. Is that the start or end date and TIME of each
segment of a trip?
Again if you are putting the destinations in a specific order, how (what
fields) do you do that? It would be helpful if you also told us about
the data types. Also the primary key field(s) in your table would be nice
to know.
The following correlated subquery may be sufficient to give you the
results you are looking for:
Assumptions:
TDate is just a date
Trips all take place on one date
Trips all take place during one shift
SELECT Location, Reading, Miles,
Odometer, Odometer -
(SELECT Min(Odometer)
FROM YourTable as Y1
WHERE Y1.VehicleNumber = YourTable.VehicleNumber
and Y1.TDate = YourTable.TDate
and Y1.ShiftNumber = YourTable.ShiftNumber) as MilesTraveled
FROM YourTable
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.
CharlesCount via AccessMonster.com said:
I have many fields that are tied into these repords, TDate, Shift Number
and
Vehicle Number are 3 thre of them.
Charles
John said:
Do you have something else that determines the vehicle and perhaps the
date
or something that tells you how the records are ordered and therefore
which
is the first record in any group?
For example in your sample data, what determis that the trip started at
10
Main Street and proceeded to 12 West Ave and then went on to 10 North
Blvd?
What data in the records do you have that say 10 Main Street was the
first
location? What data in the records do you have that says the three
records
are related to each other?
These example appear to use 2 diiferent control field, in my case I
need
to
[quoted text clipped - 37 lines]
Charles