Thread: textbox value
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Woodi2 Woodi2 is offline
external usenet poster
 
Posts: 61
Default textbox value

Thanks Joel. As you can tell I am an amateur at this. I have to ask, how
have you guys learnt this so well, have you simply picked it up or completed
training courses on it.
Thanks
Ian

"joel" wrote:

A text box is a string and cannot be compared to another string

"123" "456"

Instead something like this

do
if isnumeric( Me.TextBox2.Value) then
If val(Me.TextBox2.Value) 365 Then
MsgBox "Max Inspection Frequency is 365 Days. Please enter 365 or
less"
Me.TextBox2.SetFocus
Exit Sub
end if
else
msgbox("Bad Value")
end if
loop while not isnumeric( Me.TextBox2.Value)



"Woodi2" wrote:

I have a textbox (see below) that is checked to ensure a value no greater
than 365 has been entered. It works fine between 1 and 36 and 100 and 365.
Any value between 37 and 99 and it returns my error message. Any ideas why?

If Me.TextBox2.Value "365" Then
MsgBox "Max Inspection Frequency is 365 Days. Please enter 365 or less"
Me.TextBox2.SetFocus
Exit Sub
End If