Results 1 to 6 of 6
  1. #1
    rx8pdx is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2012
    Posts
    4

    Query - 3rd table w/no data skews results

    Here is a fictional understanding of what I'm trying to do. Customer #1 Orders a Big Mac with Fries and a drink


    Customer #2 Orders a Big Mac only.


    In my tables: Customers, Sandwhichs ordered, List of ingredients that make this sandwhich, and Add-Ons.


    So now I want to use a query to print a receipt. In the query I simply have Customer Name(Customer Table), Which Sandwhich(Sandwhich's Ordered Table) and Additional 1 (Add-Ons Table).


    So the query results will display Customer #1 correctly because he has items in "Additional 1"
    But will not show Customer #2 because "Additional 1" is blank.


    When I remove the Additional 1 field AND the Table from the query, Both customers show up.


    Any help would be appreciated I ultimately will need to generate a report with all these fields.


    P.S I have the following one-to-many relationships that work correctly: CustomerID, SandwhichID and AddonID.

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Could you post your SQL here?
    In Design View -> View -> SQL View . . . and copy the SQL & post it here for us.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Getting your tables and relationships set up correctly is key to successful database.

    There is a series of free video tutorials at the link below that have an example dealing with design aspects of
    Customer, Order, OrderItems, and Items

    see post #2 at https://www.accessforums.net/showthre...lp-with-design

  4. #4
    rx8pdx is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2012
    Posts
    4
    Quote Originally Posted by Robeen View Post
    Could you post your SQL here?
    In Design View -> View -> SQL View . . . and copy the SQL & post it here for us.
    Code:
    SELECT [Vendor Contact].Zip, Contracts.ContractID, [Vendor Contact].Fax, Contracts.SponsorID, Contracts.ContactID, Event.State, Event.City, [Vendor Contact].Email, [Vendor Contact].PrimaryPhone, [Vendor Contact].State, LSTSponsorships.Price, [Vendor Contact].Contact, [Vendor Contact].City, [Vendor Contact].Address, [Vendor Contact].Company, Contracts.Market, Contracts.Date, Addon.AddOns, Contracts.Sponsorship, Event.CityFROM [Vendor Contact] INNER JOIN (Event INNER JOIN ((LSTSponsorships INNER JOIN Contracts ON LSTSponsorships.SponsorhipID = Contracts.Sponsorship) INNER JOIN Addon ON Contracts.SponsorID = Addon.SponsorID) ON Event.Market = Contracts.Market) ON [Vendor Contact].ContactID = Contracts.ContactID
    WHERE (((Contracts.ContractID)=[Forms]![Contracts]![ContractID]));

  5. #5
    rx8pdx is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2012
    Posts
    4
    Quote Originally Posted by orange View Post
    Getting your tables and relationships set up correctly is key to successful database.

    There is a series of free video tutorials at the link below that have an example dealing with design aspects of
    Customer, Order, OrderItems, and Items

    see post #2 at https://www.accessforums.net/showthre...lp-with-design
    Thank you for working with me? are you saying it is my table structure that causes this?

  6. #6
    rx8pdx is offline Novice
    Windows Vista Access 2003
    Join Date
    May 2012
    Posts
    4
    I got it working by switching INNER JOIN Addon to a LEFT JOIN. A left join will return rows for all of the records in the table on the left if the "left join" keywords and, if there is matching data from the table on the right it will return that too. If there is no matching data, then the cell in the query for that row will be blank.

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

Similar Threads

  1. updating table using results of another query
    By AdrianoG87 in forum Queries
    Replies: 1
    Last Post: 11-23-2011, 11:24 PM
  2. Replies: 1
    Last Post: 10-24-2011, 04:11 PM
  3. Replies: 0
    Last Post: 02-24-2010, 12:56 AM
  4. Populate Table with query results
    By sparkyboy2406 in forum Queries
    Replies: 1
    Last Post: 02-23-2010, 03:51 PM
  5. Combine Query Results to One Table
    By pr4t3ek in forum Queries
    Replies: 0
    Last Post: 12-19-2008, 06:37 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