Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Between Numbers 1

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
GB
Hi,

I am testing the following numbers.

<=7
=8 and =14 and any number between these two.
=>15.

I am having a problem with the middle numbers, the code I have is:

If TotalCorrect <= 7 And txtMood.Text = "Good" Then

MsgBox "Task less than equal to 7"

End If

If TotalCorrect BETWEEN [8:14] And txtMood.Text = "Good" Then

MsgBox "Task greater than equal to 8 less than 15"

End If

If TotalCorrect >= 15 And txtMood.Text = "Good" Then

MsgBox "Task greater than equal 15"
End If


The problem is the middle part where I am trying to test if the number corect is equal to either 8 and 14 and also if the number equals any number between 8 and 14.

Any ideas?.
 
How about a select:

Code:
Select Case True 
 Case TotalCorrect<= 7 
   if txtMood.Text = "Good" Then MsgBox "Task less than equal to 7"
 Case TotalCorrect=8 or TotalCorrect=14
   If txtMood.Text = "Good" Then MsgBox "Task equal to " & TotalCorrect
 Case TotalCorrect>8 and TotalCorrect<14
  If txtMood.Text = "Good" Then MsgBox "Task between 8 and 14"
 Case TotalCorrect>=15
  If txtMood.Text = "Good" Then MsgBox "Task greater than equal 15"
End Select

;-)
Hope this helps,
Andy

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top