• running sum in a query (access 2000)

    Author
    Topic
    #395196

    I am trying to do a running sum in a query and have it done on each date (record), but unfortunately the value doesn’t incrementally change on each date. Any ideas? SQL is below:
    SELECT [q-LiabFordMotorCredit 30].Date AS DateAlias, [q-LiabFordMotorCredit 30].VendorVendee, Sum([q-LiabFordMotorCredit 30].[Amount$]) AS [SumOfAmount$], [q-LiabFordMotorCredit 30].TransactionMemo, [q-LiabFordMotorCredit 30].TransTypeAbbrev, [q-LiabFordMotorCredit 30].SpendCatagory, [q-LiabFordMotorCredit 30].[Cleared-Rec], [q-LiabFordMotorCredit 30].Balance, DSum(“Amount$”,”q-liabFordMotorCredit 30″,””) AS RunTot
    FROM [q-LiabFordMotorCredit 30]
    GROUP BY [q-LiabFordMotorCredit 30].Date, [q-LiabFordMotorCredit 30].VendorVendee, [q-LiabFordMotorCredit 30].TransactionMemo, [q-LiabFordMotorCredit 30].TransTypeAbbrev, [q-LiabFordMotorCredit 30].SpendCatagory, [q-LiabFordMotorCredit 30].[Cleared-Rec], [q-LiabFordMotorCredit 30].Balance;

    Viewing 1 reply thread
    Author
    Replies
    • #730765

      I assume this is a sequel to post 301098. If you look at the first link in my reply there, you will notice that you can use a DSum expression with a Where-condition as third argument. You have the following expression for the running sum: DSum(“Amount$”,”q-liabFordMotorCredit 30″,””). The third argument is empty, so the expression will return the same amount. I suggest that you study the MSKB articles in more detail first; if you still have questions then, come back here.

      • #730807

        Hi Hans,

        I have studied that article in detail and even downloaded the sample pack from MS TechNet. Yes, the where condition in this example is blank but trying to duplicate the example in the KB article I did in fact name the Date field as DateAlias and set up an expression in the WHERE condition asking it to return values where i.e [datealias] <= [date]

        • #730826

          You have a number of fields in your GroupBy clause that will cause the sum to be for very small groups of records. If you want it to just sum by date, you have to remove any fields other than date in the GroupBy clause.

        • #730827

          You have a number of fields in your GroupBy clause that will cause the sum to be for very small groups of records. If you want it to just sum by date, you have to remove any fields other than date in the GroupBy clause.

      • #730808

        Hi Hans,

        I have studied that article in detail and even downloaded the sample pack from MS TechNet. Yes, the where condition in this example is blank but trying to duplicate the example in the KB article I did in fact name the Date field as DateAlias and set up an expression in the WHERE condition asking it to return values where i.e [datealias] <= [date]

    • #730766

      I assume this is a sequel to post 301098. If you look at the first link in my reply there, you will notice that you can use a DSum expression with a Where-condition as third argument. You have the following expression for the running sum: DSum(“Amount$”,”q-liabFordMotorCredit 30″,””). The third argument is empty, so the expression will return the same amount. I suggest that you study the MSKB articles in more detail first; if you still have questions then, come back here.

    Viewing 1 reply thread
    Reply To: running sum in a query (access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: