Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Running sum in subform

Status
Not open for further replies.

tanolalano

Technical User
Jul 7, 2003
27
0
0
IT
Hi all!

I try the running sum that i've find in the faq faq702-5248.
The problem is that when I use the code in a subform the running sum doesn't work. I get #Error in the unbound control.
Then I create a form whit the same origin and the same control to see if I do all corectly. So, running sum in the new form works perfectly.

How do I solve the problem??
Thanks in advance
 
tanolalano . . .

The new code for the FAQ has been posted (the main global routine)!

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
For simple forms/subforms, you can also use
Code:
Static total@

Function runSum()
    total = total + Me!amt
    runSum = total
End Function
Set the running sum control's ControlSource to =runSum()

Note that if you're letting the user resort the form, the static variable 'total' has to be reset, as well as when refreshing, requerying, etc.

Max Hugen
Australia
 
maxhugen . . .

. . . and how would you go about resetting the total?

User can add,edit & delete values and/or records . . .


Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top