if statement

J

Joel Allen

Hello,

I have this and it doesn't quite work:

If InStr(1, Item.UserProperties("WindowRating") ,"20") > 0 Then
colFields("min20").CheckBox.Value = True
end if

I want colFields("min20").CheckBox.Value = True
If WindowRating has a 20 in it like this (20 or 20,120), but not if
WindowRating only = 120

Thanks for your help,
Joel
 
S

Sue Mosher [MVP-Outlook]

Then use Left() instead of Instr():

If Left(Item.UserProperties("WindowRating"), 2) = "20" Then
 
J

Joel Allen

Thanks Sue, but sometimes the value is this:

"non-rated,20,120"

Then use Left() instead of Instr():

If Left(Item.UserProperties("WindowRating"), 2) = "20" Then
 
S

Sue Mosher [MVP-Outlook]

Well, the more detail you provide the better. We can't read minds. What else haven't you told us about possible values? Why not just add a second Instr() to check for "120"?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
J

Joel Allen

Thanks, that worked.

Well, the more detail you provide the better. We can't read minds. What else
haven't you told us about possible values? Why not just add a second Instr()
to check for "120"?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Top