A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Setting a Category



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7  
Old July 5th 07, 12:50 AM posted to microsoft.public.outlook.program_forms
Scott07
external usenet poster
 
Posts: 28
Default Setting a Category

Here is some code. I've commented where my code to & two statements together
is. Any help is appreciated. Thanks.

Function Item_Write()
Set myinspector = Item.GetInspector
Set test = myInspector.ModifiedFormPages("Availability")
Set Test2 = test.Controls("Test2")
Set Test3 = test.Controls("Test3")

If Test2.Value = True Then
Item.Categories = Item.Categories & ",Test2"
ElseIf Test3.Value = True Then
Item.Categories = Item.Categories & ",Test3"

//////The code below doesn’t work for some reason. It seems to output
Test2, but not Test2 & Test3. Is it because of the order of my "if" clauses?
If so, how should I restructure them. If not, please let me know what else
you believe it could be.

ElseIf Test2.Value & Test3.Value = True Then
Item.Categories = Item.Categories & ",Test2 & Test3"

End If
End Function


"Sue Mosher [MVP-Outlook]" wrote:

Look at the rest of your If ... Then ... End If block. If the criteria have already been met earlier, code execution never gets to the ElseIf statement.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Scott07" wrote in message ...
Thanks for the fast reply. If I only check, for example, Test1, the Category
is set properly. Also, if I check Test2, it works properly. However, if I
check both and invoke the code below, the Category will remain blank.


"Sue Mosher [MVP-Outlook]" wrote:

What's the specific problem? It looks like what this code is supposed to do is check whether two controls both return True and, if they do, append a new category names "Test1 & Test2" to the categories that already exist on the item.



"Scott07" wrote in message ...
Thanks, that worked. I'm having trouble with the following code, as well.
I've tried varying combinations because I know it's a syntax problem, but
none have worked:

ElseIf test1.Value & test2.Value = True Then
Item.Categories = Item.Categories & ",Test1 & Test2"



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sort by category in the category view captaindarth Outlook - Using Contacts 2 February 16th 07 11:53 PM
print a contact list of business category only no other category Adriana Outlook - Using Contacts 3 January 18th 07 08:55 PM
How do I set up a default category for appointments w/o category Mike Outlook - Calandaring 0 December 5th 06 03:59 PM
Setting reminders by rule or category in Outlook 2003? hmjarvis Outlook - Calandaring 0 June 21st 06 07:18 AM
How to set due date for a Category of Tasks? Or set any field that applies to the whole category? [email protected] Outlook - Calandaring 1 February 4th 06 09:23 PM


All times are GMT +1. The time now is 08:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.