Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91

    Having trouble creating relationships.


    delete post
    Last edited by qwerty; 10-28-2018 at 08:49 PM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    What field would have Null? By 'no blank cells' you mean no empty string data but can be Null? Can certainly use an autonumber as PK.

    Do you have a table of Locations?

    LocID Location Region
    1 Nebraska West
    2 Alaska West

    Save the LocID into Species table. Join tables to retrieve Region info.


    Nebraska is misspelled in your example.
    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
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    delete post
    Last edited by qwerty; 10-28-2018 at 08:49 PM.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Tell us more in simple plain English about your project - no jargon. Try to answer the who, what, why,where,how, how much or how often sort of questions that someone may ask about your project. eg Is this for Birds only?? You haven't shown the scope of the data.
    For more info on Database Planning and Design

    Good luck.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Then you are working backwards if you want to use Subdatasheet. The + sign should be on the Locations table and show related species records.

    Should not work directly with tables and queries. Build forms and reports.

    Build a report that uses a query joining tables to pull together all related info.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    delete post
    Last edited by qwerty; 10-28-2018 at 08:49 PM.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Your linking is incorrect. CANNOT link tables on two primary key fields in a x-to-many relationship. One table must have Primary key and other table saves that value as Foreign key.

    Link should be on LocID and Location fields.

    But I think you have a many-to-many relationship which requires another table: PlantLocations

    Fields like: PlantID, LocID, DateSeen, SeenBy
    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.

  8. #8
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    Can you draw an example, there is no option for foreign key?

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    PlantID and LocID would be foreign key fields in the new table. Maybe call them PlantID_FK and LocID_FK

    This would be a 'junction' table between PlantSpecies and Locations (note the plural on table name Locations).
    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.

  10. #10
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91

    solved

    delete post
    Last edited by qwerty; 10-28-2018 at 08:51 PM. Reason: delete post

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    I do not Skype.

    You did not create the junction table I describe. Need ANOTHER table called PlantLocations. Locations and PlantSpecies will both link to the new table. Location will no longer be a field in PlantSpecies.

    Then you need to enter data into this new table. Options:

    1. a single form bound to PlantLocations with comboboxes to select Location and Species.

    2. main form bound to Locations, subform bound to PlantLocations with a combobox to select species

    3. main form bound to PlantSpecies, subform bound to PlantLocations with a combobox to select location

    Example at http://ms-access-tips.blogspot.com/2...y-to-many.html

    Set LocID_FK and PlantID_FK fields as compound index to prevent duplicate pairs. Review http://www.geeksengine.com/article/c...ex-access.html
    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.

  12. #12
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    I created a junction table and the fields are still blank. The data from plant species and location are not showing.

  13. #13
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    solved....thank you for your support

  14. #14
    qwerty is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    91
    Last question, under the location table it is only showing 0001 matching with another table data 0001 id for that specific location. How do I make it show all data for that specific location, not just the first.

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Why did you edit posts to delete content?

    1. build form/subform as described in post 11, option 2

    2. build report

    3. use Subdatasheet on table
    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.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 11-22-2017, 09:13 AM
  2. Replies: 3
    Last Post: 10-10-2017, 08:09 AM
  3. Replies: 6
    Last Post: 11-08-2013, 03:48 PM
  4. Replies: 1
    Last Post: 07-27-2010, 08:02 AM
  5. Replies: 7
    Last Post: 06-16-2010, 09:19 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