InstructionWhich7142
Registered User.
- Local time
- Today, 13:35
- Joined
- Feb 24, 2010
- Messages
- 206
Updated (Quick Subtotals using FindPrevious) now using Seek
Updated - New code in last post
Hi,
I'm trying to do this:
I know it's not right, but I don't understand how it works well enough to know how I should have written it 
I'm trying to replace this:
Which is SOOOOOOO SLOW, and which I couldn't make update itself
By doing FindPrevious to get the last value, then adding it to the current value and writing the new total back to the same field
Updated - New code in last post
Hi,
I'm trying to do this:
Code:
Dim db As DAO.Database
Dim Rst As DAO.Recordset
Set db = CurrentDb
Set Rst = db.OpenRecordset("sndbasis")
Do Until Rst.EOF
Rst.Edit
Rst.Fields("Demand").Value = Rst.Fields("Demand").Value + (Rst.FindPrevious "pstk = '" & Rst.Fields("pstk").Value & "'", Rst.Fields("Demand").Value)
Rst.Update
Rst.MoveNext
Loop
Rst.Close
Set Rst = Nothing

I'm trying to replace this:
Code:
Rst.Fields("Demand").Value = DSum("[requirement]", "sndbasis", "[cldate]<=#" & Format(Rst.Fields("cldate").Value, "mm/dd/yyyy") & "# and [PSTK] = '" & Rst.Fields("pstk").Value & "'")
By doing FindPrevious to get the last value, then adding it to the current value and writing the new total back to the same field
Last edited: