I do some error checking on my textbox. The problem is that if I enter
a valid number, then backspace until the box is empty, my msgbox pops up
saying "Data Error". Is there a way to avoid this?
Also, if I enter invalid data and try to backspace through it, my "Data
Error" msgbox pops up. This is rather annoying. Does anyone have a
solution to this problem? I posted my code - I hope it formats correctly.
Thanks.
Private Sub txtAmtSold_Change()
If txtAmtSold = "" Then
mnuEditCalculate.Enabled = False
End If
If IsNumeric(txtAmtSold) Then
If Val(txtAmtSold) >= 1 And Val(txtAmtSold) _
<= 100 Then
mnuEditCalculate.Enabled = True
Else
mnuEditCalculate.Enabled = False
MsgBox "Error: Numbers must be in the range of 1 - 100",
vbExclamation, "Range Error"
End If
Else
mnuEditCalculate.Enabled = False
MsgBox "Data Must Be Numeric", vbExclamation, "Data Error"
End If
End Sub