Results 1 to 4 of 4
  1. #1
    EnFEngraving is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2019
    Posts
    1

    Total Cost of components parts in 2 databases

    Hi all,

    very new to Access and just trying to use it to set up a simply Stock Inventory system for myself.

    Basically I have a table called 'Product Parts' and another table called 'Products' .

    in 'Products' I want to add items as components from the 'Product Parts' table and get a Total cost price of the Component parts added together.

    I've set the products table up with a 'Look up' on the Component Fields and assigned them to the elements in the Product Parts table.

    I now have no idea how to get the Cost prices of the components and product the Total Sum which would show up on my Form/table.

    I have no idea what to look for to help me with my problem, Query or Coding?

    Click image for larger version. 

Name:	Problem1.jpg 
Views:	17 
Size:	100.0 KB 
ID:	38506Click image for larger version. 

Name:	Problem2.jpg 
Views:	16 
Size:	120.8 KB 
ID:	38507



    Ive attached a couple of screenshots which will show my problem just for complete clarity.

    John

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    none of that sounds right. first, ditch the table lookup field.
    the evils of lookup fields - http://access.mvps.org/access/lookupfields.htm
    Table and PK design tips - http://www.fmsinc.com/free/newtips/primarykey.asp
    About calculated table fields - http://allenbrowne.com/casu-14.html

    One part has several components and there is a components table and a parts table?
    tblParts - any fields that relate to only the part
    tblComponents - all fields related to components only, regardless of what part they might go into
    tblPartComponent - junction having tblParts.PartID and tblComponent.CompID as foreign keys

    Normalization Parts I, II, III, IV, and V
    http://rogersaccessblog.blogspot.com...on-part-i.html
    and/or
    http://holowczak.com/database-normalization/
    Last edited by Micron; 05-27-2019 at 03:08 PM. Reason: spelin and gramur
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Multiple fields for product items is not a normalized data structure. You are limited to 2 items. What if someday need 3 or more?

    Conventional approach is to have a related dependent table for the components. Each component would be a record. Then use aggregate function Sum() to total the component records.

    Saving calculated data is usually unnecessary and even dangerous - calculated value can get 'out of sync' with raw data. Saving also requires code - macro or VBA.

    If you stick with multiple fields, then calculation would be: Nz(field1,0) + Nz(field2,0)

    This is really basic Access functionality. Have you studied an introductory tutorial book?
    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.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I agree with Micron and June ---your basic structure is not Normalized.
    You should review some Relational Database concepts and principles.
    See the Database Planning and Design link in my signature for more info.
    I recommend you work through 1 or 2 of the tutorials from RogersAccessLibrary mentioned in that link.
    You will learn and experience the concepts if you spend 30-45 minutes and work through the tutorials.

    If you have assembled Components that can contain Parts and you want to record information about the "assembly", then the following diagram (at last the Parts/Final Product side) may be helpful.

    Click image for larger version. 

Name:	ProductAssembledFromParts.PNG 
Views:	15 
Size:	44.0 KB 
ID:	38508

    It was designed for a poster who had a number of individual Parts. He sold Final products to Customers. In his case some Final Products were individual Parts, and some were Assemblies made up of multiple Parts. Also, some Parts were sourced from external suppliers.

    Good luck with your project.

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

Similar Threads

  1. View components as products
    By blueman in forum Queries
    Replies: 1
    Last Post: 10-05-2015, 07:21 AM
  2. Replies: 3
    Last Post: 04-18-2015, 12:01 PM
  3. Replies: 3
    Last Post: 01-18-2015, 06:05 PM
  4. Replies: 3
    Last Post: 08-02-2012, 11:37 AM
  5. MS Graph problem with X and Y components
    By Triztan in forum Reports
    Replies: 1
    Last Post: 07-05-2012, 11:27 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