Results 1 to 3 of 3
  1. #1
    Anderlt is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    1

    Exclamation How to pass 2 tables data to third table?

    Hello. I have to tables, that I want to form the third table from their data. So one table is for the quantity of products that were made to be entered and the other is for taken quantity out of stock.


    Entered quantity table:

    Click image for larger version. 

Name:	graph.png 
Views:	15 
Size:	22.3 KB 
ID:	40181

    Taken quantity out of stock:

    Click image for larger version. 

Name:	grapha.png 
Views:	15 
Size:	19.7 KB 
ID:	40182


    THIRF TABLE DATA ( The table I want to see):


    Click image for larger version. 

Name:	aa.png 
Views:	15 
Size:	22.3 KB 
ID:	40183

  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,652
    Where to start. You shouldn't have a table with that data, it should be dynamically calculated in a query. I hope you don't have a set of tables for each product, that would be a big design mistake (search on normalization). Spaces and symbols in object names are more trouble than they're worth in the long run.

    Given that the fields are the same, I personally would have a single table with negative amounts for the "taken" records. Then you can use a simple sum to get the balance. As you have it, you have to join the two tables together in a query. Presumably you'd also have a products table, which could also be joined so that you see all products, whether they have records in both tables or not. Search on running sum or running total to see how to get the currently in stock column.

    My fingers are tired, let's start there.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Apr 2017
    Posts
    1,792
    About table design:
    Date is reserved word - use e.g. EntryDate instead;
    Instead employee name in various tables have a table where all employees are registered. Every employee in this table must have an unique ID which is used as foreign key I other tables. User selects employee in any form in combobox - user ID is stored, but his/her name is displayed;
    Instead product name have a products table with unique product ID. Rest is same as with employees;
    Your tables contain storage transactions really. Like pbaldy adviced, you better have all transactions in single table, and have there a field which determines transaction type. Simplest design will have only 2 types (in and out). Entry quantity for type 'in' will be in all calculations positive, for type 'out' negative. More advanced design has a table for transaction types, where for every type a multiplier (1 or -1) is saved. This design allows you to differ between purchases, sales, products given out or returned, scraping, inventory corrections, etc.

    Current saldo of product in storage will be sum of (all entries multiplied with movement type multiplier). Saldo at certain date will be sum of (all entries with date equal or less of query date multiplied with movement type multiplier).

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

Similar Threads

  1. Replies: 13
    Last Post: 06-03-2018, 11:00 PM
  2. Replies: 1
    Last Post: 02-08-2018, 09:59 PM
  3. Replies: 2
    Last Post: 10-07-2016, 02:42 PM
  4. Replies: 3
    Last Post: 08-27-2014, 11:42 AM
  5. Pass Through Queries - Local and Network Tables
    By vinfurnier in forum Queries
    Replies: 1
    Last Post: 03-31-2011, 11:18 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