Results 1 to 10 of 10

Thread: Looping records

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    Looping records

    im using ms access as backend database;

    this are my records;

    Debit ---> Credit ---> Balance
    ============================
    0.00 ---> 100.00 ---> 0.00
    50.00 ---> 0.00 ---> 0.00
    0.00 ---> 25.00 ---> 0.00
    75.00 ---> 0.00 ---> 0.00

    now using Do while | Loop statement it goes like this;
    Debit Credit Balance
    ===========================
    0.00 100.00 100.00
    50.00 0.00 50.00
    0.00 25.00 75.00
    75.00 0.00 0.00


    Balance = Credit - Debit

    is there an easiest way to do this w/o looping the records? because if it is thousand of records? it takes me time before it display the results

    kindly help me pls?

  2. #2

  3. #3
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Looping records

    I used MS Access, while the program graws the execution time greatly increases. so i just moved to MSSQL and now feel very comfortable.

    Consider moving to MSSQL

  4. #4
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Looping records

    You have created the same thread twice.

  5. #5

  6. #6
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Looping records

    Quote Originally Posted by BillGeek
    If you only want to display the Balance (credit - debit) then just change your SQL query a bit:
    Code:
    SELECT credit - debit FROM tablename
    Its not a per record calculation... its a running balance, previous balance is adjusted with current debit and credit to get current balance.

  7. #7

  8. #8
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Looping records

    Quote Originally Posted by BillGeek
    According to the original question asked, it seemed like the aim was to display the Credit, Debit and (Credit - Debit)... Am I missing something?
    Your misinterpreting the data, probably 'cause you looked at only the first 2 lines.

    Credit 100 to 0 --- Balance 100
    Debit 50 from 100 --- Balance 50
    Credit 25 to 50 --- Balance 75
    Debit 75 from 75 --- Balance 0

  9. #9

  10. #10
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Looping records

    Duplicate threads merged.

    Please do not create multiple threads for the same question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width