'smatter with my If statement???

# Thread: 'smatter with my If statement???

1. dep
Senior Member
Join Date
Dec 1969
Posts
709

## 'smatter with my If statement???

If ((IsNumeric(dbhandle(5))) AND (CDbl(dbhandle(5)) &#062;= 80 OR CDbl(dbhandle(5)) &#060;= 100)) Then<BR>levelone = levelone + 1<BR>ElseIf ((IsNumeric(dbhandle(5))) AND (CDbl(dbhandle(5)) &#060; 80 OR CDbl(dbhandle(5)) &#062;= 60)) Then<BR>leveltwo = leveltwo + 1<BR>ElseIf ((IsNumeric(dbhandle(5))) AND (CDbl(dbhandle(5)) &#060; 60 OR CDbl(dbhandle(5)) &#062;= 40)) Then<BR>levelthree = levelthree + 1<BR>ElseIf ((IsNumeric(dbhandle(5))) AND (CDbl(dbhandle(5)) &#060; 40 OR CDbl(dbhandle(5)) &#062;= 20)) Then<BR>levelfour = levelfour + 1<BR>ElseIf ((IsNumeric(dbhandle(5))) AND (CDbl(dbhandle(5)) &#060; 20 OR CDbl(dbhandle(5)) &#062;= 1)) Then<BR>levelfive = levelfive + 1<BR>End If<BR><BR><BR>Thanks for any help on why this is falling into level one for every record...<BR><BR>dep<BR>

2. Senior Member
Join Date
Dec 1969
Posts
3,195

## RE: 'smatter with my If statement???

Its ugly<BR><BR>sorry couldn&#039;t resist ; )

3. dep
Senior Member
Join Date
Dec 1969
Posts
709

## lol - figured it out :)

If ((IsNumeric(dbhandle(5))) AND (CDbl(dbhandle(5)) &#062;= 80 ***AND*** CDbl(dbhandle(5)) &#060;= 100)) Then<BR>levelone = levelone + 1<BR><BR>... etc<BR><BR>oops.<BR><BR>dep<BR>

4. Senior Member
Join Date
Dec 1969
Posts
2,809

## RE: 'smatter with my If statement???

If ((IsNumeric(dbhandle(5))) AND (CDbl(dbhandle(5)) &#062;= 80 OR CDbl(dbhandle(5)) &#060;= 100)) Then <BR>levelone = levelone + 1 <BR><BR>You&#039;re looking for a number that&#039;s either greater than 80 or less than 100...I&#039;d like you to find me a number that *isn&#039;t* either greater than 80 for less than 100...:)<BR><BR>Probably need AND there...<BR>

5. Senior Member
Join Date
Dec 1969
Posts
506

## RE: 'smatter with my If statement???

May be cleaner...<BR><BR>If ((IsNumeric(dbhandle(5))) AND CDbl(dbhandle(5)) &#060; 20) Then <BR>levelone = levelone + 1 <BR>ElseIf ((IsNumeric(dbhandle(5))) AND CDbl(dbhandle(5)) &#060; 40) Then <BR>leveltwo = leveltwo + 1 <BR>ElseIf ((IsNumeric(dbhandle(5))) AND CDbl(dbhandle(5)) &#060; 60) Then <BR>levelthree = levelthree + 1 <BR>ElseIf ((IsNumeric(dbhandle(5))) AND CDbl(dbhandle(5)) &#060; 80) Then <BR>levelfour = levelfour + 1 <BR>ElseIf ((IsNumeric(dbhandle(5))) AND CDbl(dbhandle(5)) &#060; 100) Then <BR>levelfive = levelfive + 1 <BR>End If<BR><BR>It will match on the first one it reaches...<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
•