Stored value

  • Thread starter Thread starter William
  • Start date Start date
W

William

I want create a form where you can accumulate the number.
Can anybody help me please? Here is the sample how I want:

Employee # 1 has three records

Earn Total
Jan 8 8
Feb 10 18 *current earn10 plus total previous month8
March 10 28 *current earn10 plus total previous month18

I want to make this as a subform link to Employee, but
the problem is I could not refer the value from previous
record and add up to a final record. **make Total as a
buffer to store value and count from record i to last
record.

Or if anybody has a easier way, Please advise

Thank you,
William
 
William said:
I want create a form where you can accumulate the number.
Can anybody help me please? Here is the sample how I want:

Employee # 1 has three records

Earn Total
Jan 8 8
Feb 10 18 *current earn10 plus total previous month8
March 10 28 *current earn10 plus total previous month18

I want to make this as a subform link to Employee, but
the problem is I could not refer the value from previous
record and add up to a final record. **make Total as a
buffer to store value and count from record i to last
record.


That's called a running sum. Report text boxes have a
property you can set to get the report to take care of it
for you.

Unfortunately, that feature doesn't exist for form controls.
The standard way to display what you want is to use a
subquery in the form's record source query:

SELECT employeeID, month, earn,
(SELECT Sum(X.earn)
FROM table AS X
WHERE X.employeeID = table.employeeID
AND X.month <= table.month
) AS Total
FROM table
 
Back
Top