Results 1 to 8 of 8
  1. #1
    Squeally is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    4

    Another Table/Relationship Question


    Hello All! I'll first apologize as I haven't used access in 9 or 10 years or so. I have developed 2 tables for the data I collected. It's basically a 2-page data sheet. So, follow me here...there must be a page one. However, there does not have to be a page 2. If there is, it must relate to a specific page 1. There can also be multiple page 2s (with different information of course) that must relate back to a specific page 1. What is the best way to do this? The only duplicate data are GPS coordinates in each table, but that may have just been a way to keep the datasheets together. If anyone needs specific information, it can be provided...I just didn't want to bore you. Hopefully, that is reasonably clear. Thanks!

    Tom

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Records of associated tables are related by primary and foreign key fields. Sounds like your PK/FK is GPS coordinates.
    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
    Squeally is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    4
    Thanks June! That's what I was thinking, but I was having trouble getting it to work (due to my ignorance of course!). Should I get rid of the auto-generated primary key and choose lat and long?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    The autonumber only serves as PK if the value is saved in related table as FK in a number (long integer) field.

    Leaving the autonumber field doesn't hurt, just don't designate it as PK if the value is not in related table as foreign key.

    If both tables have autonumber field then there is no relationship based on those fields.

    Are Lat and Long in separate fields? Are these pairs unique?

    Most db designers would recommend the autonumber be used as PK. This would require updating a field in related table with the autonumber value as a foreign key.
    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
    Squeally is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    4
    The lat/long are separate fields with 10 decimal places each (generally recorded in decimal degrees). So, every pair would be completely unique.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    You can guarantee uniqueness? That would be a compound PK. I avoid that whenever possible but it should work.
    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.

  7. #7
    Squeally is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    4
    I can guarantee that no lat/long combination will be repeated with 10 decimal places. Out of curiosity, why do you avoid compound PKs?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Because if a related table is needed, both values must be saved into related table as foreign key. Queries must join the tables by linking on both pairs of fields.
    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.

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

Similar Threads

  1. Table relationship question
    By Lothar in forum Database Design
    Replies: 4
    Last Post: 06-16-2014, 03:58 PM
  2. Table Relationship Question
    By ccchan in forum Access
    Replies: 5
    Last Post: 03-12-2014, 07:52 PM
  3. Table relationship question
    By scoughlan in forum Database Design
    Replies: 2
    Last Post: 01-05-2012, 04:39 PM
  4. Table Relationship Question!
    By mbake085 in forum Access
    Replies: 5
    Last Post: 08-05-2010, 09:50 AM
  5. Access Table - Relationship Question
    By vixtran in forum Database Design
    Replies: 5
    Last Post: 06-12-2009, 10:10 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