well Customers are shippers and Vendors are also Shippers, how should I
represent this? Had I known up front that we'd need this, I would have
started with a Shipper's table (or some other noun representing outside
entitys with whom we do business), then I would have had a separate
table that allowed us to indicate the different business relationships
we have with that entity so that that entity could participate in a
variety of different sub-applications. Ahhhh . . . the beauty of
hindsight
--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
Lynn Trapp wrote:
Sandra,
Have you considered putting a record in the Vendor Table for all
Employees who might also be Maintence providers? Thus, they are not
only an Employee, but are also a vendor. That way you have the joy of
the single MaintProviderID field AND referential integrity.
Good point - you probably need another field on your EquipMaintSched
for MaintProviderType (Internal or External). Then there are a
couple of different ways to handle storing either Vendor or
EmployeeID - probably the easiest would be to have two fields,
VendorId and EmployeeID then throught the application, require the
appropriate one depending on whether you select Internal or External
maintenance. This will allow you to maintain referential integrity
on either field without requiring both to be entered on a record.
Another approach is to use a single MaintProviderID field and let it
contain either the VendorID or the EmployeeID depending on the value
in MaintProviderType. The downside to this approach is that you
don't get referential integrity with Vendors or Employees. On the
plus side, you can require that there is a value in the
MaintProviderId field.
There are also other ways to do this but they might be overkill.
I'd be interested in hearing opinions on this from others since this
type of issue has been a common one in my projects and I've handled
it several different ways, never feeling that there is one surefire
absolute best way to handle it.
--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
Scott A wrote:
Pinch me!
Thanks for the validation - that's exactly what I had from
the begining!
One wrinkle that's making me scratch my (puny) brain:
Depending on the maintenance type selected, the service
will be performed internally or externally. For external
service, I want to store the VendorID (FK), but for
internal service, I would like it to be the EmployeeID.
What is the best approach?
-----Original Message-----
Funny you should ask, I'm working on something very similar right
now. I would say that you need at least three other tables -
MaintTypes, EquipMaintSched, EquipMaintLog
MaintType would contain all types of maintenance available
MaintType
--------------------
MaintTypeId*
MaintType**
EquipSchedMaint would have one record for each type of required
maintenance for a particular piece of equipment and the maintenance
interval for that maintenance item.
EquipMaintSched
----------------------
EquipId*
MaintTypeId*
MaintInterval (*you would have to define the units for the interval
days, weeks, months, years)
EquipMaintLog would have one record for each time a maintenance
item is completed on a piece of equipment.
EquipMaintLog
-------------------------
EquipId*
MaintTypeID*
MaintDate*
VendorId
Remarks
* is for PK fields
** is for unique index fields
Note that I didn't columns for NextMaintDate - technically this
should be a calculated field in a query since it is dependant on
the most recent entry in the EquipMaintLog. Depending on your
situation you might want to include this as a field on
EquipMaintSched - just keep in mind the potential pitfalls of
storing data that is dependant on other data. Actually, since
there may be times that you want to force a particular date for
maintenance you might have to have a field for it (hmmm . . .
thinking about my own project here).
Also, I would assume that there could also be a need for including
Vendor information regarding which Vendors do which types of
maintenance, which are approved for the maintenance items and which
is actually used on a particular date.
--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this
newsgroup.
Scott A wrote:
I've got a table design issue that's stumping me - I'm
wondering if anyone has faced a similar problem and can
make a few recommendations as to how many tables will be
required to hold the data:
I've got one table with equipment records. This table
contains all of the details related to the piece (power
supply, name, type, etc.)...
Each piece of equipment is maintained according a schedule
(3 months, 6 months, 1 year), but can be maintained by
more than one person according to more than one schedule...
I need the database to record which types of maintenance
each piece is subject to, and the interval for which it is
maintained, and also track the dates when the services are
actually performed.
Any suggestions?
.