This topic is locked

Running Total in Access in verion ASP 5.2

2/1/2010 12:26:19 PM
ASPRunnerPro General questions
M
Maurits author

Hi all
Is it possible to have a "running total" in an access table in ASPR 5.2 ? But I don't want to store the running total in the table itself.
Table Transactions:

CustomerID

TransactionsID

TransactionsDate

TransactionsType

TransactionsReference

TransactionsMoneyIn

TransactionsMoneyOut
I have been looking with DSum, but don't have a clue of how to implement it and where to implement it.
Any help would be appreciated.
Many thanks
Maurits

C
clig 2/1/2010



Hi all
Is it possible to have a "running total" in an access table in ASPR 5.2 ? But I don't want to store the running total in the table itself.
Table Transactions:

CustomerID

TransactionsID

TransactionsDate

TransactionsType

TransactionsReference

TransactionsMoneyIn

TransactionsMoneyOut
I have been looking with DSum, but don't have a clue of how to implement it and where to implement it.
Any help would be appreciated.
Many thanks
Maurits


add something like this to your query in asprunner
select OrderId, OrderDate, O.OrderAmt

,(select sum(OrderAmt) from Orders

where OrderID <= O.OrderID)

'Running Total'

from Orders O

  • or create a query in your access db and use that as a source in asprunner rather than the table itself therefore the values would not be stored in your db but pulled when the query is executed - make that field read only in your asprunner pages / remove it from the edit page
    a good example on dsum - add this type of code as a column in your query in msaccess
    http://support.microsoft.com/kb/290136

M
Maurits author 2/1/2010

So far I got:
SELECT '', DSum("[Transactions.TransactionMoneyIn]" - "[Transactions.TransactionMoneyOut]","Transactions","[Transactions.CustomerID]<=" & [CustomerID] & "") AS RunTotal

FROM Transactions

GROUP BY Transactions.TransactionDate
But if I put this in the SQL query editor, it comes up with error messages.
In normal human words:

Click on Master-Detail, click Account then

SELECT
DSUM (moneyIn - moneyOut) from table Transactions WHERE CustomerID=Variable and ORDER TransactionDate
What it should do is and show on the View page is (Like a bank statement):
CustomerID Date Type Reference MoneyIN MoneyOut RunningTotal
1 11/12 Cre Start 100.00 100.00

1 11/12 Cre Credit 200.00 300.00

2 01/12 Cre Start 200.00 not shown

2 01/12 Deb Refund 50.00 not shown

1 15/12 Deb Pay out 50.00 250.00
It should only show records with the CustomerID=1 with a total running, but this total may not be stored in the database.
Please I need help with this code and also how do you implement this into the Custom Table View?

C
clig 2/2/2010



So far I got:
SELECT '', DSum("[Transactions.TransactionMoneyIn]" - "[Transactions.TransactionMoneyOut]","Transactions","[Transactions.CustomerID]<=" & [CustomerID] & "") AS RunTotal

FROM Transactions

GROUP BY Transactions.TransactionDate
But if I put this in the SQL query editor, it comes up with error messages.
In normal human words:

Click on Master-Detail, click Account then

SELECT
DSUM (moneyIn - moneyOut) from table Transactions WHERE CustomerID=Variable and ORDER TransactionDate
What it should do is and show on the View page is (Like a bank statement):
CustomerID Date Type Reference MoneyIN MoneyOut RunningTotal
1 11/12 Cre Start 100.00 100.00

1 11/12 Cre Credit 200.00 300.00

2 01/12 Cre Start 200.00 not shown

2 01/12 Deb Refund 50.00 not shown

1 15/12 Deb Pay out 50.00 250.00
It should only show records with the CustomerID=1 with a total running, but this total may not be stored in the database.
Please I need help with this code and also how do you implement this into the Custom Table View?


Use DSUM in an MSACCESS query and use that query as your source in ASPRunner else you need to use ODBC compliant SQL 92 to create running totals etc with SQL designer in ASPRunner