RECrerar
08-16-2007, 03:48 AM
Hi, i have the following code, used in userform that should check that the value Entered in the "Elem From" text box is smaller than the number entered in the "Elem To" text box, and shows an error message and clears the entries if these conditions are not met.
This works for most values, However is I enter for example 95001 in the 'Elem From' box and 100000 in the 'Elem To' box the error message is displayed and the values removed. 100000 is greater than 95001 so why does this happen and how do I stop it happening?
If ElemFrom.Value > ElemTo.Value Then
Msg = "Please re-enter the Element Range" & vbNewLine & vbNewLine
Msg = Msg & "The Element Range must be FROM Low TO High Element ID"
Error = MsgBox(Msg, , "Invalid Data Entry")
ElemFrom.Text = ""
ElemTo.Text = ""
ElemFrom.SetFocus
Exit Sub
End If
This works for most values, However is I enter for example 95001 in the 'Elem From' box and 100000 in the 'Elem To' box the error message is displayed and the values removed. 100000 is greater than 95001 so why does this happen and how do I stop it happening?
If ElemFrom.Value > ElemTo.Value Then
Msg = "Please re-enter the Element Range" & vbNewLine & vbNewLine
Msg = Msg & "The Element Range must be FROM Low TO High Element ID"
Error = MsgBox(Msg, , "Invalid Data Entry")
ElemFrom.Text = ""
ElemTo.Text = ""
ElemFrom.SetFocus
Exit Sub
End If