Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default textbox value

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default textbox value

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default textbox value

I learned by pulling my hair out and grinding my teeth. Mainly trial and
error and when things became tough I went to a good book store (didn't by the
books) and looked through the book to get the answers. there wer too many
different problems that one book wasn't enough. I only found this sight
after I learned visual basic on my own. the site help improvement my
knowledge.

I have a very strong software background in lots of different programming
languages. My problem is I hate BASIC, especially the Excel visual basic
that I got really go at. the language is very inconssitant and there are a
lot of tricks only the experts really know.

The poor microsoft documentation goes back to the days were Bill Gates was
really developing DOS. He had a team of Gurus who new the inner workings of
the operating system. Over the years I've read lots of books and tried to
keep up the the secretes of the languages, but haven't always been successful.

"Woodi2" wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP! I Lost The Ability To Advance From TextBox To TextBox With the ENTER Or The TAB Keys Minitman[_4_] Excel Programming 0 February 22nd 05 08:50 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:47 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:43 PM
How to move cursor from one textbox control to another textbox con Tom Ogilvy Excel Programming 1 September 16th 04 03:42 PM
How to move cursor from one textbox control to another textbox con KMoore007 Excel Programming 0 September 16th 04 02:47 PM


All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"