DSum

  • Thread starter Thread starter Krish
  • Start date Start date
K

Krish

I am running a query to get a running sum of Deposit amount. Instead of a
running total, I get in each row the cumulative total. What am I doing
wrong?
SELECT MISC_DS.DEP_AMT, MISC_DS.DEP_DATE, DSum(" [DEP_AMT]
","[MISC_DS]","[DEP_DATE]=#02/10/2005# ") AS RSum, MISC_DS.F6
FROM MISC_DS
WHERE (((MISC_DS.DEP_DATE)=#2/10/2005#));
Thanks.
krish
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In the DSum() you have to indicate you want the data on, or before, the
date. In the main query's WHERE clause you usually have a range of
dates - how can you have a running sum for one day, unless you have time
values in the date value. Do you? And, in the DSum() function's
criteria parameter you have to have a reference to the date in the main
query.

Try this:

SELECT DEP_AMT, DEP_DATE,
DSum("[DEP_AMT]","[MISC_DS]","[DEP_DATE]<=" & M.Dep_Date) AS RSum, F6
FROM MISC_DS As M
WHERE DEP_DATE BETWEEN #2/1/2005# and #2/10/2005#

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQkMXzoechKqOuFEgEQLoDACg2UBOMxPEqX/DxbsZsOOTbRBk/nEAoJzc
PF6c7IpmGlUxzbgFjaQjR39Y
=Lo1j
-----END PGP SIGNATURE-----
 
Back
Top