|
-
May 4th, 2010, 01:16 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] If statement with multiple possible values
Is this not the correct way to do this? I get an error with it but if I change it to only one value then it works.
Code:
If dt2.Rows(0)("STATUS") = "COMP" Or "CLOSE" Or "CAN" Or "INCOMP" Or "WAPPR" Then
dt.Rows(currentRow).Delete()
End If
-
May 4th, 2010, 01:23 PM
#2
Re: If statement with multiple possible values
Code:
If dt2.Rows(0)("STATUS") = "COMP" _
Or dt2.Rows(0)("STATUS") = "CLOSE" _
Or dt2.Rows(0)("STATUS") = "CAN" _
Or dt2.Rows(0)("STATUS") = "INCOMP" _
Or dt2.Rows(0)("STATUS") = "WAPPR" Then
-
May 4th, 2010, 01:30 PM
#3
Re: If statement with multiple possible values
Code:
Select Case dt2.Rows(0)("STATUS")
Case "COMP", "CLOSE", "CAN", "INCOMP", "WAPPR"
dt.Rows(currentRow).Delete()
End Select
-
May 4th, 2010, 01:43 PM
#4
Thread Starter
Fanatic Member
Re: If statement with multiple possible values
This is what I used and it works great. David, yours would have worked too but I used Hack's version because I like for my code to flow like his example.
 Originally Posted by Hack
Code:
If dt2.Rows(0)("STATUS") = "COMP" _
Or dt2.Rows(0)("STATUS") = "CLOSE" _
Or dt2.Rows(0)("STATUS") = "CAN" _
Or dt2.Rows(0)("STATUS") = "INCOMP" _
Or dt2.Rows(0)("STATUS") = "WAPPR" Then
-
May 4th, 2010, 01:54 PM
#5
Re: [RESOLVED] If statement with multiple possible values
You might want to change those Or's to OrElse.
-
May 6th, 2010, 07:34 AM
#6
Thread Starter
Fanatic Member
Re: [RESOLVED] If statement with multiple possible values
 Originally Posted by David Anton
You might want to change those Or's to OrElse.
Great catch!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|