Results 1 to 5 of 5
  1. #1
    ban1k is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Posts
    3

    Summing the Price of Multiple Parts (Records) in Different Tables

    Greetings - I'm trying to get my head wrapped around this one; I may need just some general guidance, as I have light experience with Access.

    I am creating a database that is meant to A) find all possible combinations of given parts/components, and then B) bundle together the price of each of those parts into one complete item with total price. So, to illustrate - I would combine the below 3 'Part' tables on the left into one 'complete item' table having just two columns/fields: 'Complete Item' & 'Complete Price'.
    BasePart1 BasePart1_Price
    WTL 100



    Options1 Options1_Price
    -ABC '0
    -123 25

    Options2 Options2_Price
    '0
    -Z2 25
    -Z3 50
    COMPLETE-ITEM (All Combinations) COMPLETE-PRICE
    WTL-ABC
    ???
    WTL-123
    ???
    WTL-ABC-Z2
    ???
    WTL-123-Z2
    ???
    WTL-ABC-Z3
    ???
    WTL-123-Z3
    ???


    I used the following Query to create all possible combinations ('Complete-Item') table/field:



    Code:
    SELECT BasePart1.BasePart1 & Options1.Options1 & Options2.Options2 AS Complete-Item INTO Complete-Item
    FROM BasePart1, Options1, Options2;
    I greatly appreciate any insight or direction on solving and tying in the "Complete Price" portion to match up with the given Complete items.

    Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Try

    SELECT BasePart1.BasePart1 & Options1.Options1 & Options2.Options2 AS Complete-Item,
    BasePart1.BasePart1_Price + Options1.Options1_Price + Options2.Options2_Price AS CompletePrice INTO Complete-Item
    FROM BasePart1, Options1, Options2;
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ban1k is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Posts
    3
    Hi Paul - thanks for the quick reply! When I try inserting the suggested SQL code, I get the following result:
    CompleteItem
    CompleteItem CompletePrice
    WTL-ABC 100
    WTL-123 125
    WTL-ABC-Z3 125
    WTL-123-Z3 150
    WTL-ABC-Z3 150
    WTL-123-Z3 175

    However, we would expect the result, based on the price in each part/piece table to come out to the below (it appears the complete price and product are not coming in sync).

    Expected Result:
    CompleteItem
    CompleteItem CompletePrice
    WTL-ABC 100
    WTL-123 125
    WTL-ABC-Z3 150
    WTL-123-Z3 175
    WTL-ABC-Z3 150
    WTL-123-Z3 175


    Any thoughts as to how to amend this disconnect?
    Thanks again!

  4. #4
    ban1k is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    May 2014
    Posts
    3
    Oops! Paul - see the error of my ways here. I reentered my "sample" data incorrectly with the test.
    When I corrected Z2-Z3 mixup I pasted above, the suggested code works as expected!

    CompleteItem
    CompleteItem CompletePrice
    WTL-ABC 100
    WTL-123 125
    WTL-ABC-Z2 125
    WTL-123-Z2 150
    WTL-ABC-Z3 150
    WTL-123-Z3 175


    Thanks so much for straightening me out!

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Happy to help, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 12-01-2013, 08:13 PM
  2. Summing Multiple Queries & Summing Time
    By WEJ in forum Queries
    Replies: 2
    Last Post: 10-04-2013, 04:46 PM
  3. Appending inventory records with current price records
    By sberti in forum Database Design
    Replies: 8
    Last Post: 11-29-2012, 10:24 PM
  4. Replies: 3
    Last Post: 08-02-2012, 11:37 AM
  5. Replies: 3
    Last Post: 01-05-2012, 12:04 PM

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