This topic is locked

Running Total

5/8/2008 3:15:58 PM
ASPRunnerPro General questions
jadach authorDevClub member

How can I create a running total? I have a table that has the following: Item, QtyRec, QtyDisp, Unit, Balance
I want the users to add new, then be able to pull in the total from the LAST record and then either have it add or subtract, depending on what they enter. I want it to be kind of like a check book ledger. I can't figure out how to pull in the total from the previous record on the add new form.
Am I going about this wrong? Any help would be tryuly appreciated.
Thanks.

J
Jane 5/13/2008

Hi,
use Before record added event for this purpose.

Here is a sample:

str = "select field1, field2 from tablename order by recordID desc"

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
'add your code here

' rstemp("field1") is field value of previous record
rsTemp.Close : set rsTemp = Nothing

jadach authorDevClub member 5/13/2008

You have

'add your code here
What code? Would it be the calculation?
Thanks for your help in this!

Hi,

use Before record added event for this purpose.

Here is a sample:

J
Jane 5/13/2008

This code is dependent on your aim.

For example you can sum or subtract selected value with entered values.

jadach authorDevClub member 5/13/2008

I figured as much. Thanks Jane.

This code is dependent on your aim.

For example you can sum or subtract selected value with entered values.