Summing of Text Boxes on Form (1 Viewer)

kloot1rr

Registered User.
Local time
Today, 07:33
Joined
Jun 10, 2015
Messages
39
Hey guys, beginner here.

I have created 3 forms, 1 of which will update the sum of 5 text boxes immediately after numbers are entered in, while on the other 2 forms I had to create a refresh button so that the numbers will add up. The properties in all of the forms and the text boxes seem to be the exact same. Any suggestions?
 

Ranman256

Well-known member
Local time
Today, 08:33
Joined
Apr 9, 2015
Messages
4,337
You sum the text box names, (not field names)
the formula (property) for txtSum
= txtBox1 + txtBox2 + txtBox3...
 

kloot1rr

Registered User.
Local time
Today, 07:33
Joined
Jun 10, 2015
Messages
39
I understand that but heres the deal. The criteria for one of my forms is

=Nz([CCamount1])+Nz([CCamount2])+Nz([CCamount3])+Nz([CCamount4])+Nz([CCamount5])

this form does not sum up the numbers instantly after you enter in numbers for the text boxes. I created a refresh button so it will sum the final total but I dont want to have to do that.

My other form has the criteria

=Nz([Amount1])+Nz([Amount2])+Nz([Amount3])+Nz([Amount4])+Nz([Amount5])

On this form as soon as you enter numbers in the text the final total changes instantly. What is the difference though? "CCamounts" and "Amounts" are both fields in my table.

I can't seem to find a difference in the properties within my forms or text boxes. I'm wondering where the difference in forms is...therefore my forms can both be updating instantly when data is entered, rather than making a refresh button.

Thanks for the reply ranman.
 

Ranman256

Well-known member
Local time
Today, 08:33
Joined
Apr 9, 2015
Messages
4,337
fields are part of the recordset that may need refreshed.
the form is not and is instantaneous.
 

vbaInet

AWF VIP
Local time
Today, 13:33
Joined
Jan 22, 2010
Messages
26,374
Best to always give it an alternative value:
Code:
=Nz([CCamount1], 0)+Nz([CCamount2], 0)+Nz([CCamount3], 0)+Nz([CCamount4], 0)+Nz([CCamount5], 0)
That's not the problem anyway, but it's still worth doing.

If you reference the textbox it will calculate instantly but because you are referencing the field it needs to be commited (or saved) before it calculates. F5 commits the record.

In your other form that's working, the names of the amount textboxes is the same name as the field so it will work that way because that's the textbox value.
 

Users who are viewing this thread

Top Bottom