Results 1 to 6 of 6
  1. #1
    wardw is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2013
    Location
    Hines, Oregon
    Posts
    41

    Junction table okay for a one-to-many relationship?

    I’m building a database where volunteers can type in data on obituaries from newspapers. I have a main form, where name(s), date of death, burial place, etc. are entered for each person. Each deceased person makes one record in my main table, AllDeathRecords.




    But some deceased had multiple obituaries in different newspapers. So deceased and obituaries have a one-to-many relationship: A deceased can have many obituaries, but an obituary can have only one deceased.


    I want to avoid duplication of data, so I’ve built a junction table called MultipleObituaries, with two foreign keys: PersonID from the main table, and PublicationID from a Publications table. It will also have fields for newspaper name, date, page, and column.


    I’ve also built a subform (Multiple_Obituary_Records) where for each person the volunteer can fill in the obituary’s newspaper name, date, page, and column, for as many obituaries as the person had.


    A question: I’ve read that junction tables are used for many-to-many relationships; will mine work for my one-to-many relationship?

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by wardw View Post

    ...I’ve read that junction tables are used for many-to-many relationships; will mine work for my one-to-many relationship...
    Why in the world would you want it to? Using a Junction Table, in this situation, is senseless! Two Tables, linked by a common Field, and used in a Main Form/Subform scenario, is all that is needed.

    And...

    Quote Originally Posted by wardw View Post

    ...I want to avoid duplication of data...
    instead of helping you to avoid duplication of data, using a Junction Table will actually facilitate the entering of duplicate data!

    Preventing the entering of duplicate data, such as entering a second Main Form Record for a given deceased person, is a common task, usually done using the DLookUp Function. If you search here, or in the 'net, using the terms

    "MS Access" and "prevent duplicate data" I suspect you'll get about a gazillion hits with examples! Find and try one out, and if you run into problems post back here for help.

    Linq ;0)>

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Each person can have obituaries in multiple papers. Each paper will have multiple obituaries (each for different person). This is many-to-many relationship. The 'junction' table is the one that relates persons with papers.

    tblAllDeathRecords

    tblNewspapers

    tblObituaries
    DeathRecID (foreign key)
    NewspaperID (foreign key)
    PubDate

    Use form/subform arrangement for data entry:

    1. main form bound to tblAllDeathRecords and subform bound to tblObituaries with a combobox to select newspaper

    or

    2. main form bound to tblNewspapers and subform bound to tblObituaries with a combobox to select death record

    I expect option 1 will be preferable arrangement. In either case, if desired item not in the combobox, the NotInList event of combobox will be useful.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by June7 View Post
    Each person can have obituaries in multiple papers. Each paper will have multiple obituaries (each for different person). This is many-to-many relationship.
    I hadn't considered that. But this would only be pertinent, would it not, if you were interested in sorting/filtering by newspapers? But this doesn't appear to be of interest to the OP, here; his only stated interest is to be able to have a single listing by person, with listings of multiple obits but no duplication of person or duplication of a particular obit. In fact, he states that his reason for having a Junction Table is "to avoid duplication of data"
    Quote Originally Posted by wardw

    ...I want to avoid duplication of data, so I’ve built a junction table called MultipleObituaries...
    which in and of itself makes no sense to me.

    Linq ;0)>

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Right, the MultipleObituaries table should be same as my suggested tblObituaries. I just reread user post and their structure makes perfect sense to me and is actually in line with mine:

    "I want to avoid duplication of data, so I’ve built a junction table called MultipleObituaries, with two foreign keys: PersonID from the main table, and PublicationID from a Publications table. It will also have fields for newspaper name, date, page, and column."

    Only exception I have with that is the field for newspaper name is not necessary because the PublicationID is saved.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    wardw is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2013
    Location
    Hines, Oregon
    Posts
    41
    Thanks, Missinglinq and June7, for you analyses. It looks as if my subform will work okay, but I have another problem: It's blank in Form view. I'll start a new thread with that problem.

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

Similar Threads

  1. Junction Table
    By troachjr in forum Database Design
    Replies: 1
    Last Post: 03-08-2013, 02:10 AM
  2. Junction Table ?
    By KCC47 in forum Access
    Replies: 1
    Last Post: 02-19-2013, 10:19 AM
  3. Junction Table
    By snowboarder234 in forum Access
    Replies: 11
    Last Post: 04-18-2012, 09:31 AM
  4. How to use Junction Table to populate DB
    By Sorbz62 in forum Forms
    Replies: 1
    Last Post: 10-02-2011, 05:45 PM
  5. Junction Table
    By mae3n in forum Database Design
    Replies: 2
    Last Post: 01-15-2011, 10:23 PM

Tags for this Thread

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