obulldog27
Programmer
I need to add 5 textboxes and give the result in one textbox called misctotal.Text. Problem: When I enter a number in one field that same value shows on misctotal.Text NOT the total of all AND then when the focus is lost the misctotal.text changes to zero. All textboxes are set to currency in properties. Whats weird is when I change the dataformat under properties to number then everything adds right but the dataformat of currency does not stay for the textboxes being added. I am using ado control.
---------------------------------------------------------
Private Sub misc_gettotal(textbox)
Dim temp As Variant
Dim tempmisc1 As Variant
Dim tempmisc2 As Variant
Dim tempmisc3 As Variant
Dim tempmisc4 As Variant
Dim tempmisc5 As Variant
tempmisc1 = (misc1.Text)
tempmisc2 = (misc2.Text)
tempmisc3 = (misc3.Text)
tempmisc4 = (misc4.Text)
tempmisc5 = (misc5.Text)
temp = Val(tempmisc1) + Val(tempmisc2) + Val(tempmisc3)+ Val(tempmisc4) + Val(tempmisc5)
misctotal.Text = FormatCurrency(temp)
End Sub
---------------------------------------------------------
Private Sub misc_gettotal(textbox)
Dim temp As Variant
Dim tempmisc1 As Variant
Dim tempmisc2 As Variant
Dim tempmisc3 As Variant
Dim tempmisc4 As Variant
Dim tempmisc5 As Variant
tempmisc1 = (misc1.Text)
tempmisc2 = (misc2.Text)
tempmisc3 = (misc3.Text)
tempmisc4 = (misc4.Text)
tempmisc5 = (misc5.Text)
temp = Val(tempmisc1) + Val(tempmisc2) + Val(tempmisc3)+ Val(tempmisc4) + Val(tempmisc5)
misctotal.Text = FormatCurrency(temp)
End Sub