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

    Self join confusion


    I have a members app. each member can have a sponser (doesnot have to have a sponser.) I am trying to ultimately setup a combobox to select the sponser. But, if I relate MembersFK to Sponsers PK in the underlying query, (qrySponsers) fails. ONLY if I do not have a relationship do I get results.

    What am I doing wrong? thanks!


    Attachment 46525 Attachment 46526

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    You probably need an outer join. Which table comes first determines if the join is LEFT or RIGHT, so just double click on the join line in query design and pick one of the 2nd or 3rd options. When you read the explanation above the selection, you should understand why it probably doesn't work - not that you explained what "fails" means.
    I'm guessing you want all members regardless if they have sponsors. Your equal join means they have to be both (be in both tables).

    Watch out for the consistency of spelling members.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Synergy.ron@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    126
    Right. I want all members in my sponsers dropbox. It really is ok if they are not in the Sponsers table. I have tried all the relatioship combinations to no avail. have you gotten it to work? Admittedly my unrstanding comes from watching utube videos, but the creator did not address this situaion thanks

  4. #4
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Didn't download your db as I figured it would be that simple. Will have to give it a look I guess. Looks like you might have an IIF expression. Did you try your joins without the calculated field?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    I open your query and see
    MemberID MemberLastName fIRSTnAME SponserLast SponserFirst ISponserID
    1 Wazneac William


    2 washington george


    3 Wazneac Woodrow


    5 wazneac Steven


    9 Flintstone fred


    10 Jetson george


    11 Rubble Barney


    13 zorro Mark


    16 zorro2 Mark2


    18 gordono ronaldo


    19 wilson woodrow



    So what am I to make of that? Again, no idea of what "fails" means. Your posted db uses an outer join but your post not only doesn't, you've said it doesn't matter-
    I have tried all the relatioship combinations to no avail.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    OK, you have no data in sponsers (sp) table, so not sure what you expect to see.

    Edit - had to remove some of this post because I'm stumbling through due to lack of instructions and I have to step out for a bit. I see that those "tables" are queries thus are not aliased tables. Regardless, there is no data in the sponsors table so that conundrum remains.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Seems you are attempting to get member/sponsor data from self joining the members table. First, did you not get an error when trying to run the sponsors query? You'd have to fix the ambiguity there by specifying the table to get the field data from. Then if you use a Left join you get something. I have no idea if those results are valid.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Members and sponsors are all people. Have one table. Eliminate tblSponsers, especially since there is no data in it.

    Review http://allenbrowne.com/ser-06.html

    SponserFK field needs to be changed to number type. Then self-join:

    SELECT DISTINCT Sponsors.SponserFK, tbl_members.[prefix] & " " & tbl_members.[Lastname] & ", " & tbl_members.[Firstname] & " " & tbl_members.[m_Name] & " " & tbl_members.[suffix] AS FullName, tbl_members.LastName
    FROM tbl_members RIGHT JOIN tbl_members AS Sponsors ON tbl_members.IDMember = Sponsors.SponserFK
    ORDER BY tbl_members.LastName;



    As micron noted, sponser is a misspelling of sponsor.
    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.

  9. #9
    Synergy.ron@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    126
    I do not use the sponsers table. The problem is self join on MEMBERS using qrySponsers

  10. #10
    Synergy.ron@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2020
    Location
    washington
    Posts
    126
    Seems Like it is working. I noticed that the isSponserfk field property was set to long AND was not able to be set to INTEGER LONG. Ultimately I deleted and recreated the field and baboom works as expected. ONward to creating a combo box instead of a text box..... Thanks to al (especially micron)

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

Similar Threads

  1. Calcuation Confusion Pls Help
    By rmbohra in forum Access
    Replies: 2
    Last Post: 01-01-2014, 01:59 AM
  2. DLL Confusion
    By frankvfox in forum Access
    Replies: 6
    Last Post: 08-11-2013, 07:22 AM
  3. Query Confusion
    By tmcrouse in forum Queries
    Replies: 9
    Last Post: 07-16-2012, 09:24 AM
  4. VB and SQL confusion
    By Wayne311 in forum Programming
    Replies: 29
    Last Post: 01-31-2011, 10:27 PM
  5. Confusion
    By colenzo in forum Access
    Replies: 4
    Last Post: 07-21-2009, 06: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