BETWEEN

1. Member
Join Date
Dec 1969
Posts
39

## BETWEEN

How do I use BETWEEN in a statment? <BR><BR>I am trying to do a real simple if/then and I have 1000&#039;s of #&#039;s that are assigned a number if it is &#062; X, &#060;X or between X and X. <BR><BR>As of now, it defaults to the last rule in the statment. Here is how it looks now...<BR><BR>if yr_est = BETWEEN("0") AND ("5") then <BR>EST="2"<BR>end if<BR>if yr_est = BETWEEN("5") AND ("10") then <BR>EST="3"<BR>End If<BR>if yr_est = BETWEEN("11") AND ("15") then<BR>EST="4"<BR>End If<BR>if yr_est = BETWEEN("16") AND ("1000") then<BR>EST="5"<BR>end if<BR><BR>I also did:<BR>if yr_est &#060;="4" then <BR>EST="2"<BR>end if<BR>if yr_est = BETWEEN("4","11") then <BR>EST="3"<BR>End If<BR>if yr_est = BETWEEN("10","16") then<BR>EST="4"<BR>End If<BR>if yr_est &#062;"15" then<BR>EST="5"<BR>end if<BR><BR>Both move to the last statment...I also did both w/out the quotes

2. God
Senior Member
Join Date
Dec 1969
Posts
18,177

## If you're checking..

.. numbers, you shouldn&#039;t have the quotes.<BR><BR>Additionally, have you checked what the value of "yr_est" is?

3. Member
Join Date
Dec 1969
Posts
39

## RE: If you're checking..

Yes. The value of YR_EST comes out as a number. In this case, it is coming out as 6, which means its value should be 3...but its value is showing as 5...I took out teh quotes just now, same thing.

4. God
Senior Member
Join Date
Dec 1969
Posts
18,177

## Anyone else?

Well, I&#039;m confused - I can&#039;t actually find any reference to a "BETWEEN" statement/operator in VB.NET.<BR><BR>Have you checked the documentation?

5. Senior Member
Join Date
Dec 1969
Posts
10,852

## Nope...

No BETWEEN in VB.Net. Maybe the poster is thinking about the BETWEEN operator in SQL? <BR><BR>Regardless, he&#039;s looking for Var &#062;= SomeVal AndAlso Var &#060;= OtherVal, it would appear. <BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•