Calculator Program
I am taking a self paced course on beginner VBA and I have run into a little snag. It is a simple calculator program that has 2 text boxes and 1 label. You enter numbers into both text boxes and hit the operator sign of choice(+,-,*,/) When I click the operator buttons simultaneously(just to check for errors), it comes up with an error saying overflow. The code I have is listed below. Does anybody see what I am doing wrong?
Option Compare Database
Private Sub cmdAddition_Click()
lblAnswer.Caption = Val(txtInput1.Value) + Val(txtInput2.Value)
End Sub
Private Sub cmdDivide_Click()
lblAnswer.Caption = Val(txtInput1.Value) / Val(txtInput2.Value)
End Sub
Private Sub cmdMultiply_Click()
lblAnswer.Caption = Val(txtInput1.Value) * Val(txtInput2.Value)
End Sub
Private Sub cmdSubtract_Click()
lblAnswer.Caption = Val(txtInput1.Value) + Val(txtInput2.Value)
End Sub
|