Results 1 to 2 of 2
  1. #1
    RiVit is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    7

    Passing a calculated value from one record to the next one in the same table

    I have a table with product purchases (Oper_dia), and when I sell (Oper_SocInv) I have to do with First In First Out (FIFO), and the quantity sold (opsi_titulos), is not identical to a purchase, so that have to sell the first purchase and the remaining cover with the second purchase, and if there are remaining with the third purchase, and so on
    In the next image (form F_Oper_SocInv), you could see the inventory of the product, and the detail of each buy, also I have another subform with the sell operation (Operación).

    Click image for larger version. 

Name:	Position.JPG 
Views:	4 
Size:	39.8 KB 
ID:	6930

    With “Integra operaciones” I declare a global variable var1, and open the query Act_Oper_dia


    With the global variable I can calculate the values ​​for the first record, but I can not pass values ​​to the second record, by updating the value of var1, or any other method.

    Act_Oper_dia
    Fecha Títulos Precio Importe Tit_vta var1 Fecha Cmp
    21/03/2012 -615.00 -29.16 -615 -6715 02/03/2012
    21/03/2012 -16,389.00 -29.16 -7330 0 05/03/2012
    23/03/2012 -52.00 -29.16 -52 -7278 08/03/2012

    I need the follow result, where Tit_vta are the quantity sale by each previus buy

    opd_fecha opd_titulos Precio opd_prec opd_impte Tit_vta var1
    21/03/2012 -615 -29.1562 0 -615 -6715
    21/03/2012 -16389 -29.1562 0 -6715 0
    23/03/2012 -52 -29.1562 0 0 0

    I send you the application

    I appreciate your help
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,962
    If I understand correctly, this is a 'running sum'. Textbox on report has a RunningSum property. No so easy to do on a form. Review http://us.generation-nt.com/answer/h...-15715012.html
    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.

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

Similar Threads

  1. Calculated field for table not form
    By cheyanne in forum Access
    Replies: 1
    Last Post: 01-27-2012, 07:29 AM
  2. Replies: 9
    Last Post: 10-12-2011, 02:34 PM
  3. Replies: 3
    Last Post: 05-23-2011, 02:15 PM
  4. Replies: 12
    Last Post: 03-24-2011, 02:52 PM
  5. Calculated Text Box Populating in Table
    By Debbie in forum Access
    Replies: 2
    Last Post: 11-13-2006, 08:02 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