updated record count

meanster99

Meum cerebrum nocet!
Local time
Today, 02:22
Joined
May 2, 2006
Messages
62
Cant find what I am looking for on the forum so if anyone can help me or tell me what to search for that would be great...

I need one of my forms to display a running total of updated records, but only those records that the user clicks a command button on. i.e if i have a recordset of n records each time I move to the next one (by clicking a command button) I want the control on the form to display the count of those records that have been updated only.

I am assuming I would need to add some code to the after update event of the form or on click event of the command button but cant really figure out what code to write.

Any pointers?
 
You need to define a public variable to hold the running sum. Then in the current event:

Me.UnboundFormField = GlobalRunningSum

In the AfterUpdate event of the form:

GlobalRunningSum = GlobalRunningSum + Me.Whatever

In the Form's Open event:

GlobalRunningSum = 0
 
Thanks Pat. Sorry though, I am useless with code and need slightly more explanation please.

I declared a public variable in the top of the form (below the Option Explicit - yes?)

Code:
Public runsum as Integer

then in the current event :

rcount = runsum

In the After Update event :

runsum = runsum + 1 (I put one here because I dont know what control I was to use)

In the forms On Open :

runsum = 0

All this does is start the count on 3 when I open the form and every time I advance a record it adds 1 to the count but if I advance an updated record it adds 3 to the count.

I know I havent done exactly what you told me because i don't know what to put in the After Update event (where you said Me.whatever - I tried using different controls and i end up getting huge numbers!)

Can you help me out please?
 
I put

runsum = runsum + 1

in the on click event of the command button and everything appears to be working as I wanted.

Thanks for the guidance Pat.

Matt.
 

Users who are viewing this thread

Back
Top Bottom