Results 1 to 4 of 4
  1. #1
    jamesborne is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    13

    Running Total (Cumulative)

    Dear programming buddies,


    I have a query with the following information:

    Field 1 : Date
    Field 2: Product
    Field 3: Transaction (Purchases/Returns)
    Field 4: Quantity

    I need a 4th field that contains the running total but it has to be dependent on the "Transaction" meaning if the transaction is "purchase" then decrease the running total and if the transaction is "Returns", then increase the running total.

    Also, although its obvious, but the fact that field 2 is "products" means that each product needs its own running total.

    Thank you all in advance,
    James Borne

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    I would handle it in the following manner.
    I would have a field for purchases and a field for returns--both quantities. I would not have a field that identifies them as purchases or returns. I would then have an aggregate query that sums the purchases and returns and groups on the product.

    I would then create a second query that has the first query as the record source and add a calculation field that subtracts the purchases from the returns to give you a net quantity by product. You will only need to then run the second query as it is dependent on the first one. This is a quick way to achieve what you are looking for.

  3. #3
    jamesborne is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    13
    Dear AlanSidman,
    Thank you for your quick reply. However, I don't think that's what I'm looking for. I need the running total after each transaction. I think it has something to do with DSum..

    But thank you alot for trying to help!

    James Borne

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    In the footer of your form, you can use the DSum function. You will have to have two fields in your table as I described earlier and subtract one Dsum from the other DSum. If you only want to have one one field, then you will need to enter them as positive and negative numbers.

    Look here for the syntax on DSum

    http://www.techonthenet.com/access/f...omain/dsum.php

    Being very specific about what you are attempting will help to provide you with proper responses. I left my crystal ball at the office so I was guessing at your needs.

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

Similar Threads

  1. running or sub total using sql query in access
    By learning_graccess in forum Access
    Replies: 4
    Last Post: 10-15-2011, 05:40 AM
  2. cumulative total
    By afshin in forum Queries
    Replies: 14
    Last Post: 08-11-2011, 01:42 AM
  3. Running total
    By lololthis in forum Queries
    Replies: 5
    Last Post: 06-21-2011, 04:14 PM
  4. Cumulative total in query
    By MikeWaring in forum Queries
    Replies: 2
    Last Post: 12-18-2010, 01:40 PM
  5. Running Total in Subform
    By Scorpio11 in forum Forms
    Replies: 19
    Last Post: 07-03-2010, 05:44 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