Help with ideas,query or formula to achieve the task
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Help with ideas,query or formula to achieve the task

  1. #1
    Join Date
    Dec 2012

    Help with ideas,query or formula to achieve the task

    Guys i have data in a table with columns:


    i want to add the opening and closing balance columns to this table....... the closing balance column will be as follows

    (SUM(ABS(RECEIVE_FROM_PO + RECEIVE_XFER + RECEIVE_ADJ + RETURN1)) - SUM(ABS(ADJUSTMENT + ISSUE + PT_ISSUE + TRANSFER))) as Closing Balance...for the 1st month as per stocknumber,year and inventoryname.

    the opening balance will be the closing balance of the previous month + (SUM(ABS(RECEIVE_FROM_PO + RECEIVE_XFER + RECEIVE_ADJ + RETURN1)) of the current month minus SUM(ABS(ADJUSTMENT + ISSUE + PT_ISSUE + TRANSFER))) of the current in order to get the closing balance for the current month which will b passed to the next month to be the opening balance......

    please help with the script to get the query right..thank you for help in advance guys...

  2. #2
    Join Date
    Jan 2006
    Fox Lake, IL

    Re: Help with ideas,query or formula to achieve the task

    Setting ABS() on balances is NOT the way to do it. Nothing will ever be NEGATIVE, except the final total. Store the values IN the table, and it's easier to calculate the latest one, rather than the last 10 million.

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)