I can't seem to figure out what is wrong with this code.
Text1 receives a number from the IF statement and the txtTollerance receives a number from an ado control. (I also loaded a number in the text box with Form_Load)
The embedded IF statment fires even if the Text1 value is less than the txtTollerance value!
Note: The upper IF statement works well. The correct number is placed in the Text1 control when the program runs.
Private Sub cmdCheckLoss_Click()
If txtValueThisUpdate < txtHiVal Then
txtHold = (txtHiVal - txtTotalWithdrew) - txtValueThisUpdate
Text1 = (txtHold / txtHiVal) * 100
Text1 = FormatNumber(Text1, 0)
If Text1 >= txtTollerance Then
Label7.Visible = True
frmLossProtect.BackColor = vbRed
End If
Else
Label6.Visible = True
End If
End Sub
Text1 receives a number from the IF statement and the txtTollerance receives a number from an ado control. (I also loaded a number in the text box with Form_Load)
The embedded IF statment fires even if the Text1 value is less than the txtTollerance value!
Note: The upper IF statement works well. The correct number is placed in the Text1 control when the program runs.
Private Sub cmdCheckLoss_Click()
If txtValueThisUpdate < txtHiVal Then
txtHold = (txtHiVal - txtTotalWithdrew) - txtValueThisUpdate
Text1 = (txtHold / txtHiVal) * 100
Text1 = FormatNumber(Text1, 0)
If Text1 >= txtTollerance Then
Label7.Visible = True
frmLossProtect.BackColor = vbRed
End If
Else
Label6.Visible = True
End If
End Sub