Results 1 to 8 of 8

Thread: Balance Field in MS Access

Threaded View

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

    Re: Balance Field in MS Access

    If you had designed the database with two fields: credit and debit, then you would have been able to create an additional field that is a subquery for the running balance.

    The subquery would be something like...

    select table.*, (Select (Sum(debit) - sum(credit)) FROM table_alias where table_alias.datetime <= table.datetime and table_alias.id <= table.id) as runbalance
    from table

    You have to have a means of identifying which records come before the current record... I used date and time combioned with autoinc id (on second thought you can use just that (without the date) instead). table_alias is the same table but contains records only up to the current record in table.
    Last edited by leinad31; Oct 4th, 2005 at 02:50 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
  •  



Click Here to Expand Forum to Full Width