Results 1 to 4 of 4
  1. #1
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129

    InnerJoin error (I think)

    I have a report where I wanted to add field [TankerRefNo] from tblCharges_Tanker


    I have included the field in the query but now my report only returns values that include an entry in that field not all entries. I have been playing with the InnerJoin to no avail and now I am grey

    SELECT tblMainDel.*, tblContractor.NameContr, tblSource.NameSource, tblCharges_Tanker.TankerRefNo
    FROM tblSource INNER JOIN (tblContractor INNER JOIN (tblCharges_Tanker INNER JOIN tblMainDel ON tblCharges_Tanker.ID = tblMainDel.TankerRefFK) ON tblContractor.ID = tblMainDel.ContractorFK) ON tblSource.ID = tblMainDel.SourceFK
    WHERE (((tblSource.NameSource)<>"Transfer From"));

    where is this wrong please

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You do not want an INNER JOIN where tblCharges_Tanker is involved. I am guessing, but I think this is what you may be after. I assume that you want all records from tblMainDel and the records from tblCharges_Tanker that match:

    FROM tblSource INNER JOIN (tblContractor INNER JOIN (tblMainDel LEFT JOIN tblCharges_Tanker ON tblMainDel.TankerRefFK= tblCharges_Tanker.ID ) ON tblContractor.ID = tblMainDel.ContractorFK) ON tblSource.ID = tblMainDel.SourceFK

  3. #3
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    Me.Satisfied I spliced your code in to my statement and all is good. yes I wanted to return records to the report even if they did not include a [TankerRefNo]
    Thankyou Sir

  4. #4
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Glad that worked for you.

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

Similar Threads

  1. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  2. Replies: 2
    Last Post: 06-23-2012, 11:59 PM
  3. Replies: 7
    Last Post: 06-08-2012, 09:55 PM
  4. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  5. Replies: 1
    Last Post: 05-11-2012, 10:59 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