I'm trying to add two numbers together, and have problems with values less than 1.
Example
1 + 1 = 2
1.5 + 1.5 = 3
1.06 + 1.06 = 2.12
Problem
0.5 + 0.5 = 0.5
Here's the code I'm using:
'num1 = textbox
'num2 = textbox
'txtAmountOfTime = textbox
Private Sub cmd1Hour_Click()
num1 = 0.5
If txtAmountOfTime.Text = "" Then
txtAmountOfTime = 0.5
Else
num2.Text = txtAmountOfTime
If num1 And num2 <> "" Then
txtAmountOfTime.Text = Val(num1.Text) + Val(num2.Text)
End If
End If
End Sub
Example
1 + 1 = 2
1.5 + 1.5 = 3
1.06 + 1.06 = 2.12
Problem
0.5 + 0.5 = 0.5
Here's the code I'm using:
'num1 = textbox
'num2 = textbox
'txtAmountOfTime = textbox
Private Sub cmd1Hour_Click()
num1 = 0.5
If txtAmountOfTime.Text = "" Then
txtAmountOfTime = 0.5
Else
num2.Text = txtAmountOfTime
If num1 And num2 <> "" Then
txtAmountOfTime.Text = Val(num1.Text) + Val(num2.Text)
End If
End If
End Sub