Results 1 to 5 of 5
  1. #1
    Synergy.ron@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    126

    self-join possible?

    I have spent the last few months trying to get this to work:


    I HAVE A MEMBERSHIP DATABASE WHICH HAS A MEMBERS TABLE. WHICH HAS mEMBER_PK and sponser_fk (long integer)

    Each member has a sponser (another member so there is a self-join relatioship. I can get this to work in datasheet view BUT IT WILL NOT WORK ON FORM VIEW. WHAT AM I DOING WRONG??????

    I will post the app tomorrow.......6/11/2022 gotta jet....

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Please show us your table design and a short blurb about your application.

    Mock up: Usage of self-join -- Based on All sponsors are Members, but NOT ALL members are sponsors

    tblMember

    memid memname sponsorID
    1 John 8
    2 Jim 3
    3 Barb 2
    4 Les 7
    5 Ken 2
    6 Ivan 1
    7 Igor 2
    8 Crystal 4
    9 Amber 3

    SQL for MemberHasSponsorQ

    Code:
    SELECT m.memname AS member, s.memname AS sponsor
    FROM tblMember AS s LEFT JOIN tblmember AS m ON s.memid = m.sponsorID
    WHERE (((m.sponsorid) Is Not Null))
    ORDER BY s.memname;


    member sponsor
    Amber Barb
    Jim Barb
    John Crystal
    Les Igor
    Igor Jim
    Ken Jim
    Barb Jim
    Ivan John
    Crystal Les


    MembersWhoAreNotSponsorsQ

    Code:
    SELECT tblMember.memname
    FROM tblMember
    WHERE (((tblMember.memid) Not In (SELECT distinct tblMember.sponsorID
    FROM tblMember)));
    Result is

    memname
    Ken
    Ivan
    Amber

    Hope this is helpful.

  3. #3
    Synergy.ron@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    126
    What i am after is a form that allows me to input from a combobox the members and their pk, then upon selection, the Memberpk would be inserted into member![SponserFK] completing the relatioship......

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,407
    In your download, I see that you are building around the nice working functional DB that I emailed you in February 2021. The membership form allows sponsor assignments via a simple combobox. That database has been thoroughly mishandled and spoiled with unadvisable changes that have rendered it completely unusable.
    If you'd like a fresh start, here's pristine copy of it again. I suggest you make it a MASTER copy to save and not modify. You can return to the pristine version to make working copies whenever you might require additional fresh starts.

    LodgeMembership-davegri-v03.zip
    Last edited by davegri; 06-15-2022 at 08:14 AM.

  5. #5
    Synergy.ron@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    126
    ThanksDave, goog igea to keep an un altered copy of your solution. It does seem to have the problem of no sending thepk to the fk. Something for me to learn from. Thanks for your help.

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

Similar Threads

  1. Replies: 7
    Last Post: 07-10-2020, 11:44 AM
  2. Replies: 6
    Last Post: 02-26-2019, 11:53 PM
  3. INNER JOIN vs LEFT OUTER JOIN
    By shylock in forum Access
    Replies: 3
    Last Post: 10-16-2018, 09:38 AM
  4. Replies: 3
    Last Post: 09-20-2017, 09:50 AM
  5. Replies: 6
    Last Post: 11-19-2013, 01:38 AM

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