Results 1 to 6 of 6
  1. #1
    Xur is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2013
    Posts
    3

    Lightbulb Cumulative stock by Id

    Hello, i need help to make a query with the follow information, i attach a sample maybe can help

    Order table
    OrderDate----IdOrder--IdProduct--QuantityOrder
    01-08-2013---10001---1501------100
    01-08-2013---10001---1502------100
    01-08-2013---10001---1503------100
    01-08-2013---10001---1504------100
    02-08-2013---10002---1501------200
    02-08-2013---10002---1502------200
    02-08-2013---10002---1503------200
    02-08-2013---10002---1504------200

    Stock table
    IdProduct--QuantityStock
    1501-------150
    1502-------150
    1503-------300
    1504-------200


    RESULTS!!!
    OrderDate----IdOrder--IdProduct--QuantityOrder--StocktoOrder--NewStock
    01-08-2013---10001---1501------100--------------100------------50
    01-08-2013---10001---1502------100--------------100------------50
    01-08-2013---10001---1503------100--------------100------------200
    01-08-2013---10001---1504------100--------------100------------100
    02-08-2013---10002---1501------200--------------50-------------(-150)
    02-08-2013---10002---1502------200--------------50-------------(-150)
    02-08-2013---10002---1503------200--------------200------------0
    02-08-2013---10002---1504------200--------------100------------(-100)



    TestDB.accdb

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    RESULTS!!!
    OrderDate----IdOrder--IdProduct--QuantityOrder--StocktoOrder--NewStock

    01-08-2013----10001-------1501---------100-----------------100----------------50
    All of the data in blue are from the table "Orders".

    You will have to explain about the last two columns:"StocktoOrder" and "NewStock". Where do the numbers in red come from??

  3. #3
    Xur is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2013
    Posts
    3
    Quote Originally Posted by ssanfu View Post
    All of the data in blue are from the table "Orders".

    You will have to explain about the last two columns:"StocktoOrder" and "NewStock". Where do the numbers in red come from??
    Hi, the "StocktoOrder" is the free stock allocation based on "QuantityOrder", and "NewStock" is the result of "QuantityStock" - "QuantityOrder"

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    the "StocktoOrder" is the free stock allocation based on "QuantityOrder"
    Okay....... "based on" means ...what???? Is this a calculation?
    What is the process?? Is this an inventory system?

    Looked at your example dB. There are not any "idProducts" that match in the two tables, the numbers are different than what you posted.......... I'm confused!!


    Words are free. No limit on this forum.

    Remember, you understand what you want and how the dB should work; we do not know anything about your project. And my crystal ball is in the shop...

  5. #5
    Xur is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2013
    Posts
    3
    Quote Originally Posted by ssanfu View Post
    Okay....... "based on" means ...what???? Is this a calculation?
    What is the process?? Is this an inventory system?

    Looked at your example dB. There are not any "idProducts" that match in the two tables, the numbers are different than what you posted.......... I'm confused!!


    Words are free. No limit on this forum.

    Remember, you understand what you want and how the dB should work; we do not know anything about your project. And my crystal ball is in the shop...
    first!, sorry, english isn't my language, i gonna try to explain me better

    This is not a inventory system is an order system (an idea btw), i need to know how many orders are 100% covered with my stock from "Stock table", that gonna tell about how many orders can i dispatch and how many orders need to complete with new productions

    example if the order calls for 100 units of product 1501, if exist in stock, such stock is then assigned, then that stock is no longer a free stock, changes to StocktoOrder

    the NewStock is the result of the subtraction between StocktoOrder and Stock from Stock table

    you tell me about de idproduct are not the same between two tables, this confused me because i see there existe the same code in both tables "1501, 1502, 1503..."

    I really apologize if I do not understand well

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    you tell me about de idproduct are not the same between two tables, this confused me because i see there existe the same code in both tables "1501, 1502, 1503..."
    When I down load TestDB.accdb from Poat#1:
    In table "Stock", field "IdProduct" has 100001,100002, 100003, & 100004
    In table "Order", field "IdProduct" has 1501, 1502, 1503 & 1504



    This is not a inventory system is an order system (an idea btw)
    OK, maybe you want an order system, but when you start trying to determine if the stock on hand covers the orders, you have an inventory system.

    i need to know how many orders are 100% covered with my stock from "Stock table", that gonna tell about how many orders can i dispatch and how many orders need to complete with new productions

    example if the order calls for 100 units of product 1501, if exist in stock, such stock is then assigned, then that stock is no longer a free stock
    Yes, an inventory system....


    Have you used pencil and paper first to draw out your requirements, describe what you want to do, table structures, relationships???
    Most people start by creating tables, without fully understanding their requirements.

    I usually have at least 3 or 4 revisions of tables and design before I start creating objects. And sometimes I still have to make changes and start over.

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

Similar Threads

  1. Need help in calculating cumulative
    By Abd-Radhi in forum Access
    Replies: 1
    Last Post: 03-28-2012, 04:40 PM
  2. cumulative total
    By afshin in forum Queries
    Replies: 14
    Last Post: 08-11-2011, 01:42 AM
  3. Cumulative total in query
    By MikeWaring in forum Queries
    Replies: 2
    Last Post: 12-18-2010, 01:40 PM
  4. cumulative sum how
    By arctushar@yahoo.com in forum Queries
    Replies: 2
    Last Post: 10-07-2010, 08:43 PM
  5. Cumulative sum (columns)
    By ravens in forum Queries
    Replies: 1
    Last Post: 03-02-2010, 08:14 PM

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