How do I add the total of two tetboxes together in vb code. I need the total
displayed in a textbox called "total"
the textboxes are "f5" & "f6"
Thanks
Greg
How do I add the total of two tetboxes together in vb code. I need the total
displayed in a textbox called "total"
the textboxes are "f5" & "f6"
Thanks
Greg
Use the chaneg events for the two "input" boxes to call a proc that
will update the total box. You will also need to handle errors and
non-numeric input. The basics are below. Please let me know if this
is what you were looking for.
Private Sub f5_Change()
RecalcTotal
End Sub
Private Sub f6_Change()
RecalcTotal
End Sub
Private Sub RecalcTotal()
Dim dblF5 As Double
Dim dblF6 As Double
If IsNumeric(Me.f5.Value) And IsNumeric(Me.f6.Value) Then
dblF5 = CDbl(Me.f5.Value)
dblF6 = CDbl(Me.f6.Value)
Me.total.Value = dblF5 + dblF6
Else
'handle non numeric input here
End If
End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks