Results 1 to 5 of 5
  1. #1
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243

    Duplicate Values in the index, primary key or relationship

    Click image for larger version. 

Name:	DuplicateValues.jpg 
Views:	8 
Size:	153.7 KB 
ID:	7247
    Notice the last two entries in the table have the same publisher and the same student, which is generating the error message as titled in this message. However, the article titles are different.

    Starting with the tblPublicationJunction table, I changed the Publications_FK index to accept duplicates on the premise that it's permissible to have duplicate publishers because some students will repeatedly be featured in the same journal with the defining variable being the different journal titles. However, Access seems to disagree.

    Any recommendations or options on how to address this?

    Files bounded by the red rectangle are the ones at issue:
    Click image for larger version. 

Name:	Publishers.jpg 
Views:	8 
Size:	97.2 KB 
ID:	7248


    Disclaimer: I am unable to upload this 2010 database into a lower version.

    Thank you in advance to anyone who can offer assistance.

    Also, if anyone knows why Access is truncating the hyperlinked titles it would be helpful. However, that's not as serious an issue at this point. The duplicate values takes precedence.
    Last edited by snowboarder234; 04-19-2012 at 07:21 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Both fields are identified together as primary key. This is a compound pk. The combination of the two values cannot be repeated. Either remove the pk designation from both fields or must include the title as another part of the compound key. Unless possible repeat entry of author/publisher/title is a real concern, I recommend the first. This table pk is not referenced anywhere, pk not needed on this table.

    The hyperlink is not really truncating, it is the display text. The hyperlink still works.

    I suggest you edit your post to replace or remove the link to db that has student contact info.
    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.

  3. #3
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    Sorry, I don't understand. You're saying a junction table is not necessary? I'm confused. The relationships are thus:
    1 student = many publishers/titles. The student can have many titles in one publication.
    1 publisher = many authors[aka students]

    Never mind -- I finally figured it out. I was making it needlessly complex. You don't need the junction. I see that now.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    How can one publication have many titles?

    The junction table is needed if each publication can have many authors and each author can have many publications which is a many-to-many relationship. This was my original understanding and appears to be what you describe.

    I assume each publication will have only one publisher.
    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.

  5. #5
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    Quote Originally Posted by June7 View Post
    How can one publication have many titles?

    The junction table is needed if each publication can have many authors and each author can have many publications which is a many-to-many relationship. This was my original understanding and appears to be what you describe.

    I assume each publication will have only one publisher.
    I'm sorry was unable to make this more clear in the first posting. Each publication has multiple titles because it's a scientific journal which is a compilation (or a magazine) of different titled articles by different students (aka authors). So:
    Each student (author) can have one title in many different publications
    Each student (author) can have one title in the same publication
    Each title is unique to each student (author)
    Each publication has many students (authors)
    So for example, student/author Smith has two different articles in the same publication. That's where I started to run into trouble with the junction table.

    In any case, what I ended up doing was putting the Title and Publication into one table: tblPublications; Then linking that to the tblStudent. I'm not sure that's the most elegant solution, but it correctly links up each student with each article they've published, which is the goal.
    Click image for larger version. 

Name:	Junction_Publishers.jpg 
Views:	6 
Size:	94.7 KB 
ID:	7278

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

Similar Threads

  1. Replies: 4
    Last Post: 01-14-2016, 02:18 PM
  2. Replies: 3
    Last Post: 10-11-2011, 01:43 PM
  3. Replies: 37
    Last Post: 08-10-2011, 09:43 AM
  4. Replies: 9
    Last Post: 07-14-2011, 07:20 AM
  5. index/primary cannot contain null value
    By BinHDreW in forum Access
    Replies: 1
    Last Post: 05-26-2011, 08:25 PM

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