Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / July 2005

Tip: Looking for answers? Try searching our database.

if statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joel Allen - 27 Jul 2005 17:55 GMT
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
Sue Mosher [MVP-Outlook] - 27 Jul 2005 18:52 GMT
Then use Left() instead of Instr():

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

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Hello,
>
[quoted text clipped - 10 lines]
> Thanks for your help,
> Joel
Joel Allen - 27 Jul 2005 21:37 GMT
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

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Hello,
>
[quoted text clipped - 10 lines]
> Thanks for your help,
> Joel
Sue Mosher [MVP-Outlook] - 27 Jul 2005 21:42 GMT
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"?

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Thanks Sue, but sometimes the value is this:
>
[quoted text clipped - 18 lines]
>> Thanks for your help,
>> Joel
Joel Allen - 27 Jul 2005 23:07 GMT
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"?

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Thanks Sue, but sometimes the value is this:
>
[quoted text clipped - 20 lines]
>> Thanks for your help,
>> Joel
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.