Hello, I'm trying to run a query were I get the running total (runttl)from a calculated field and I want to get the running total (runttl)from the previous record and add it and display it in the current record. when I try this
SELECT DLookUp("[runttl]","cash disbursment","[id]>=" & [id]-1) AS PreviousBalance, [Cash Disbursment].id, [Cash Disbursment].Date, [Cash Disbursment].MoneyOrder, [Cash Disbursment].CashIn, [Cash Disbursment].TellerDrawer, [Cash Disbursment].CashOut, [Cash Disbursment].ATMIn, [Cash Disbursment].ATMOut, [Cash Disbursment].LooseCoin, [Cash Disbursment].MuteSold, [moneyorder]+[cashin]-[cashout]+[atmin]-[loosecoin]-[atmout]-[mutesold] AS subtotal, [subtotal]+[tellerdrawer]+[runttl] AS Totals, Val(DSum("[moneyorder]+[cashin]-[cashout] +[atmin] -[loosecoin]-[mutesold]-[atmout]","Cash disbursment","[id] <= " & [id] & "")) AS runttl, DLookUp("[runttl]","Cash Disbursment","[ID] = " & [ID]-1) AS PreviousTTL
FROM [Cash Disbursment];
it gives me zeros on the field that I want from the previous record (PreviousTTL). I don't know if it's because runttl is a calculated field. can some one help me I will really appreciate it.
SELECT DLookUp("[runttl]","cash disbursment","[id]>=" & [id]-1) AS PreviousBalance, [Cash Disbursment].id, [Cash Disbursment].Date, [Cash Disbursment].MoneyOrder, [Cash Disbursment].CashIn, [Cash Disbursment].TellerDrawer, [Cash Disbursment].CashOut, [Cash Disbursment].ATMIn, [Cash Disbursment].ATMOut, [Cash Disbursment].LooseCoin, [Cash Disbursment].MuteSold, [moneyorder]+[cashin]-[cashout]+[atmin]-[loosecoin]-[atmout]-[mutesold] AS subtotal, [subtotal]+[tellerdrawer]+[runttl] AS Totals, Val(DSum("[moneyorder]+[cashin]-[cashout] +[atmin] -[loosecoin]-[mutesold]-[atmout]","Cash disbursment","[id] <= " & [id] & "")) AS runttl, DLookUp("[runttl]","Cash Disbursment","[ID] = " & [ID]-1) AS PreviousTTL
FROM [Cash Disbursment];
it gives me zeros on the field that I want from the previous record (PreviousTTL). I don't know if it's because runttl is a calculated field. can some one help me I will really appreciate it.