PDA

Click to See Complete Forum and Search --> : [RESOLVED] ms access query/ form accumulate value


bambo
May 20th, 2006, 09:48 AM
I have an ms query with items and values. I'd like to create a form based on it with a third column holding the accumulated value. for example:

item......price.......accum price
1...........1.5..............1.5
2...........2................3.5
3...........1................4.5

nagasrikanth
May 20th, 2006, 08:49 PM
Dim rst As Recordset
Dim prevval As Double
Set rst = CurrentDb.OpenRecordset("select * from table1")
While Not rst.EOF
rst.Edit
rst("accum") = prevval + rst("price")
rst.Update
prevval = rst("accum")
rst.MoveNext
Wend


where table1 is ur table (not a query) containing the items and values..

If ur problem got resolved,then please rate the post..

bambo
May 22nd, 2006, 03:42 AM
thanks a lot