how to make running sum in a continous form field

sanal

Registered User.
Local time
Today, 13:59
Joined
Mar 10, 2018
Messages
11
I have a continous form and the value in a field in it, is consecutive numbers. When I change the number in one of the record the numbers in all the below rows will automatically changed to keep the consecutive pattern. Is there any way to achieve this goal.
 
Is this a value saved in a table?
 
Hi. Just in case it might help, take a look at this demo. Cheers!
 
if it is not Autonumber field, then you can make it happen.
use the BeforeUpdate and AfterUpdate event of the textbox.
you also need a form-wise variable:
Code:
Dim meBookmark As Variant

Private Sub textboxName_AfterUpdate()
    Dim currValue As Long
    With Me.RecordsetClone
        .Bookmark = meBookmark
        currValue = Me.textboxName.value
        .MoveNext
        While Not .EOF
            currValue = currValue + 1
            .Edit
            !ControlSourceName_Of_TextboxName = currValue
            .Update
            .MoveNext
        Wend
    End With
End Sub

Private Sub textboxName_BeforeUpdate(Cancel As Integer)
    meBookmark = Me.Bookmark
End Sub
 

Users who are viewing this thread

Back
Top Bottom