Accumulated Balance In Query

  • Thread starter Thread starter wisemax
  • Start date Start date
W

wisemax

Date Cash-In Accumulated

1/1/2006 $5.00 5
1/2/2006 $23.00 $28.00
1/3/2006 $12.00 $40.00
1/31/2006 $21.00 $61.00

How do I build the third field in a query?

Thanks in advance

HZ
 
SELECT TransactionDate, [CashIn],
DSum("[CashIn]","Finance","TransactionDate <=" &
Format([TransactionDate],"\#mm\/dd\/yyyy\#")) AS Accumulated
FROM Finance;

Note that Date isn't a good choice for a field name, as it's a reserved
word. Cash-In isn't a great choice either, because of the - in it (it can be
confused with subtraction)
 
Thank you Doug for your prompt help. But after I run this SQL, I see
this below

SELECT CashPaid.TransactionDate, CashPaid.CashPaidAmount,
DSum("[CashPaidAmount]","CashPaid","TransactionDate <=transactiondate")
AS Accumulated
FROM CashPaid;


Date Paid Cash Paid Amount Accumulated
2/1/1997 $500.00 2000
3/1/1997 $800.00 2000
11/5/1996 $700.00 2000


What I did is wrong?
 
That's not what I said to use. Look at what I gave you again (reproduced
below, with names changed to reflect your new information).

See how I've got transaction date outside of the quotes in the DSum, and I'm
using the Format statement on it?

SELECT TransactionDate, CashPaidAmount,
DSum("[CashPaidAmount]","CashPaid","TransactionDate <=" &
Format([TransactionDate],"\#mm\/dd\/yyyy\#")) AS Accumulated
FROM CashPaid;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top