I have some code already in place but my problem lies with trying to add 4 textboxs (currency) to another textbox5. when i try to add them all together 1 thru 4 it works. but when I try to add 1 thru 3 leaving off #4 it does not work. same thing happens if i leave off textboxs 2 and 3 . can anybody assist me please.
Code:
Private Sub cmdenter_click() Dim STRTOTAL As Currency Dim INTNUM1 As Currency Dim INTNUM2 As Currency Dim intNUM3 As Currency Dim INTANSWER As Currency STRTOTAL = Me.TextBox5.Value INTNUM1 = TextBox1.Value INTNUM2 = TextBox2.Value intNUM3 = TextBox3.Value intNUM4 = TextBox4.Value If INTNUM2 = "" And intNUM3 = "" And intNUM4 = "" Then INTANSWER = INTNUM1 Me.TextBox5.Value = " SUM; " & INTANSWER Else If intNUM3 = "" And intNUM4 = "" Then INTANSWER = (INTNUM1 + INTNUM2) Me.TextBox5.Value = " SUM; " & INTANSWER Else If intNUM4 = "" Then INTANSWER = INTNUM1 + INTNUM2 + intNUM3 Me.TextBox5.Value = " SUM; " & INTANSWER Else 'If STRTOTAL = "" Then INTANSWER = INTNUM1 + INTNUM2 + intNUM3 + intNUM4 Me.TextBox5.Value = " SUM; " & INTANSWER End If End If End If End Sub
Comment