Message box

J

John.bb

I have been using the following code to prompt a message when data in a text
box changes to a particular value.
If Me.TheTextBox = "Particular Value" Then
MsgBox "Out Of Specification"
End If
This works fine when the value is text. However I cannot get it to work on
numerical values e.g.
If Me.TheTextBox >100 Then
MsgBox "Out Of Specification"
End If
What am I doing wrong?
 
R

Rick Brandt

John.bb said:
I have been using the following code to prompt a message when data in
a text box changes to a particular value.
If Me.TheTextBox = "Particular Value" Then
MsgBox "Out Of Specification"
End If
This works fine when the value is text. However I cannot get it to
work on numerical values e.g.
If Me.TheTextBox >100 Then
MsgBox "Out Of Specification"
End If
What am I doing wrong?

Try...

If Val(Me.TheTextBox) >100 Then
MsgBox "Out Of Specification"
End If
 
Top