My Assistant
![]() ![]() |
|
|
Mar 28 2008, 07:39 AM
Post
#1
|
|
|
UtterAccess Addict Posts: 136 |
I'm trying to get the previous record's value to do a type of running sum. I need to do something like the below.
ID.....Credit.....Debit.....Balance 1......5.00.......0..........5.00 2......10.00......0..........15.00 3......0.........5.00..........10.00. Does anyone know a way I can do this in a query? I was thinking about identifying the previous id value but I can't figure out how to do it. |
|
|
|
Mar 28 2008, 08:21 AM
Post
#2
|
|
|
UtterAccess VIP Posts: 1,420 From: NV |
Hi,
Take a look at ATT. I made you a sample of how it's done.
Attached File(s)
|
|
|
|
Mar 28 2008, 08:23 AM
Post
#3
|
|
|
UtterAccess Addict Posts: 136 |
Thanks, juro. Is there anyway that you could just post the expression you used? I can't download through my server.
|
|
|
|
Mar 28 2008, 08:27 AM
Post
#4
|
|
|
UtterAccess VIP Posts: 1,420 From: NV |
oops I made a mistake, forgot to include Total to get Balance
Attached File(s)
|
|
|
|
Mar 28 2008, 08:30 AM
Post
#5
|
|
|
UtterAccess VIP Posts: 1,420 From: NV |
Hi,
Create Field expression in query as such Total: Nz([YourTable]![Credit],0)-Nz([YourTable]![Debit],0) Create another Field expression Cash Balance: Format(DSum("Total","QueryName","TablePK <=" & [TablePK]),"Currency") If Credit or Debit not applicable you don't have to enter 0, Nz function will take care of it. Edited by: jurotek on Fri Mar 28 9:37:44 EDT 2008. |
|
|
|
Mar 28 2008, 10:17 AM
Post
#6
|
|
|
UtterAccess Addict Posts: 136 |
Thanks, Worked perfectly.
|
|
|
|
Mar 28 2008, 10:18 AM
Post
#7
|
|
|
UtterAccess VIP Posts: 1,420 From: NV |
YW,
Glad we could help. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 23rd May 2013 - 05:57 PM |