Walter
I'm confused by the table structure you've described, and I'm not sure what
your intentions are. see comments in-line below:
> >-----Original Message-----
> Jeff,
[quoted text clipped - 21 lines]
> TruckID
> OdometerID
This table seems to only hold the endpoint of an entire trip (all segments).
Or are you using "trip" synonymously with "trip segment"?
> tblOdometer:
> OdometerID (autonumber)
> Odometer
> O/DDescriptionID
I don't understand why this is a separate table.
> tblOdometerDescription:
> O/DDescriptionID (autoNumber)
> O/DDescription (state line, fuel, trip end, etc)
> OdometerID
I don't understand why this is a separate table.
> tblFuel:
> FuelID (autonumber)
> Gallons
> Cost
> OdometerID
I don't understand why this is a separate table.
> tblStates:
> State (state abbreviation - PK)
> OdometerID
I don't understand how States and Odometers are related, and this table
looks like you can only have a state associated with one OdometerID.
> My question is how to relate these tables.
I'm going to suggest that you revisit your table structure -- rather than
try to force the structure you have to work.
> I understand
> that each truck will have more than 1 trip details.
You left out "each Truck can have more than one Trip". You need a Truck and
a Trip table, related 1:M.
AND, each Trip can have more than one TripDetail (two tables, 1:M).
> Each
> trip details will have more than 1 Odometer reading
> (OD).
This implies that each TripDetail record (one-to-many, for each Trip) can
have an Odometer reading. I don't understand why a TripDetail record would
need many Odometer readings, if the TripDetail record only recorded facts
about one segment.
> Each trip details can also have more than 1 OD
> description, fuel, and state. However, each OD can only
> have 1 OD description, 1 fuel, 1 state. Should I relate
> OD description, fuel, and state to the trip details table
> as a 1:many relationship or should they be related to the
> OD table as a 1:1 relationship?
Given my previous comment, I don't see this at all.
> At the end of each calendar quarter, I will have to
> generate a report based on the total number of miles
> traveled in each state and the total gallons of fuel
> purchased in each state. One thing I was confused about
> on the tables you set up was why the difference in table
> prefix, i.e. tbl, tlkp, trel. What is tlkp & trel?
I use my own, ideosyncratic, but fairly common "prefixing" convention to
help identify the type of table (and query, and form, and ...). For my use,
"tbl" is Table, a base table; "tlkp" is a "lookup table", useful in a
support role, but not of primary significance (e.g., a table of State
abbreviations); "trel" is a "relation table" (also known as a junction or
resolver table), used to handle the junction between two many-to-many
tables.
> I appreciate you taking the time to look at this.
> Walter

Signature
Good luck
Jeff Boyce
<Access MVP
Walter - 20 Jan 2005 17:58 GMT
>-----Original Message-----
>Walter
[quoted text clipped - 32 lines]
>
>The table name may be confusing. This table is to store
the basic information for each trip: date, truck number,
driver. Some of the FK fields in the tables I'm sure are
unnecessary and may need to be deleted. I included them
while I was trying to decide how the relationships should
be defined. The location field may be better in another
table. It's purpose is to verify accounting for all
miles. On the main form when a truck is selected(from
combo box list of active trucks)the last trip's ending
location and odometer reading will be displayed but can't
be changed. There will be a subform in which to enter the
odometer readings for each trip. Maybe some of the
following tables should be combined for this purpose. I
am trying to figure out how to design them in order to
accomplish what I need to do. Each odometer reading can
only have 1 Description(Stop,Fuel,State Line). If the
Description = Fuel there can only be one fuel entry for
that odometer reading. If the Description = State Line
there can only be 1 State entry for that odometer reading,
etc. However, 1 trip can have multiple fuel entries and,
or multiple state entries but each is associated with it's
own odometer reading. Another lookup table of Stop
descriptions(I didn't include this in my last post)would
include the stop description of "Trip End". This
selection would enable an entry in the Location field
which would end data entry for this trip and would be the
source for the next trip's beginning location for this
truck.>
>> tblOdometer:
>> OdometerID (autonumber)
[quoted text clipped - 4 lines]
>
>>I'm now thinking that this would be the "details" table
for the trip and include the Location and Fuel Cost &
Gallons fields.
>> tblOdometerDescription:
>> O/DDescriptionID (autoNumber)
[quoted text clipped - 3 lines]
>I don't understand why this is a separate table.
>This is a lookup table since there 4 or so possible valid
entries.
>> tblFuel:
>> FuelID (autonumber)
[quoted text clipped - 10 lines]
>I don't understand how States and Odometers are related, and this table
>looks like you can only have a state associated with one OdometerID.
The states table is also a lookup table. I am trying to
design this so the maximum amount of data entry will be
from selection of choices instead of typing for ease of
use and accuracy. When an odometer is entered as a state
line, this establishes the beginning mileage for that
state. When another state line is entered, this
establishes the ending mileage for the present state and
the beginning mileage for the new state. Therefore,
subtracting the beginning from the ending gives you the
mileage for this state which is one of the main purposes
for this project.
I hope I've addressed all of your questions and appreciate
your help.
Many thanks again,
Walter
>> My question is how to relate these tables.
>
[quoted text clipped - 44 lines]
>> I appreciate you taking the time to look at this.
>> Walter