Results 1 to 8 of 8
  1. #1
    thebigthing313 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    119

    How to handle a specific type of relationship


    Hello all,

    I am curious as to how to best structure a situation like this:

    There are two main activities that warrant their own tables: tblInspections, tblAerialInspections.
    Either of these activities may or may not generate a sample. Never more than one.

    Is it best practice to have a tblSamples with two foreign keys, one for tblInspections and one for tblAerialInspections, and then either or, but never both, will have a value?
    Or is it better to store a SampleID in both tables?
    Or is there better method?

    Thanks in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Cant you put both into 1 table called tblInspections and a field to differentiate
    [inspType]
    AERO
    NORM

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    You should google supertype/subtype and see if any of the associated links give you any insight on this issue.

    Why, in plain English, do these warrant separate tables? They may very well, but I'd like to know how you decided that.
    Do you have clear definitions of each of these terms?

  4. #4
    thebigthing313 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    119
    The information collected by Regular Inspections and Aerial Inspections are completely different and unrelated, but they each can generate a sample. All samples are handled the same though, and can in turn result in 0 to many analysis results.

    Reading up on supertype/subtype now.

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    If the 2 "things" are completely different and unrelated, then it sounds like you have separate things.

    Super and sub type are meant to deal with situations such as

    Employees --- we have 3 types Salaried, WeeklyWage and Casual as and when needed

    or Vehicles --- Cars (passenger capacity), Trucks (number of axles), MotorCycles, Airplane

    My first impression with your tables was Inspections (super), Aerial (sub), Regular(sub) BUT I don't think this applies.

  6. #6
    thebigthing313 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    119
    Yea, after reading up, I ended up with the same conclusion. I'm not sure on what to look up for what applies to my situation to structure this in the best way. Any further advice would be appreciated.

    EDIT: Unless of course having two Samples table is the best solution, but that doesn't seem right to me since those Samples tables will have the exact same fields, with the only difference being a foreign key field linked to the PK of either tblInspections or tblAerialInspections.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    I'm not following the
    completely different and unrelated
    and
    those Samples tables will have the exact same fields,
    .

    How about giving readers 4 or 5 records of each type of Inspection, and see what comments arise?

  8. #8
    thebigthing313 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    119
    So the fields make sense, this database is for mosquito control. Here are the involved tables:

    Code:
    tblInspections
    PK_InspectionID, FK_InspectorID, FK_InspectionSiteID, InspectionDate, ysnIsWet, FK_BreedingDensityID, ysnPresentStage1,..2,..3,..4
    
    tblAerialSprayZoneChecks
    PK_AerialSprayZoneCheckID, FK_SprayZoneID, FK_InspectorID, InspectionDate, FK_RecommendedCourseOfAction
    1:M
    tblAerialInspections
    PK_ASInspectionID, FK_AerialSprayZoneChecksID, Latitude, Longitude, FK_HabitatID, ysnIsWet, LarvaePerDip
    Each of these activities can generate zero or one sample. My idea of how the samples tables would work:

    Code:
    tblSamples
    PK_SampleID, FK_BiologistID, AnalyzedDate
    1:M
    tblSamplesResults
    PK_ResultsID, FK_SampleID, FK_MosquitoSpeciesID, NumberOfLarvae
    I know these are the actual fields, but if sample records would help better, let me know.
    If I only make one pair of these sample tables, I am trying to find the proper way (best practice) to identify if a sample came from tblInspections or from tblAerialInspections.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Not sure what type of relationship to use
    By randolphoralph in forum Access
    Replies: 13
    Last Post: 09-19-2014, 12:16 PM
  2. Replies: 1
    Last Post: 07-17-2014, 05:51 PM
  3. Replies: 1
    Last Post: 04-24-2014, 06:31 AM
  4. Replies: 19
    Last Post: 03-11-2014, 10:02 PM
  5. Help creating a specific type of form
    By an amicable guy in forum Forms
    Replies: 1
    Last Post: 11-12-2013, 11:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums