View Single Post
  #3  
Old July 2nd 07, 04:12 PM posted to microsoft.public.outlook.program_forms
Scott07
external usenet poster
 
Posts: 28
Default Setting a Category

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"



"Sue Mosher [MVP-Outlook]" wrote:

This is not a valid If ... Then statement:

If SummerWeekday.Value = True & Then

the & needs to be removed since there are no strings to join.

--
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 news
Hi,

I'm having trouble adding to my code to set a Category by clicking a
Checkbox. I'm getting an error on line 8. I think something is wrong with
the If-Then clauses, but I researched a bit and it seems right (although
probably not). If I remove the SummerEvening and SummerSaturday lines,
everything works fine. Here's the code:

Function Item_Write()
Set myinspector = Item.GetInspector
Set test = myInspector.ModifiedFormPages("Availability")
Set SummerWeekday = test.Controls("SummerWeekday")
Set SummerEvening = test.Controls("SummerEvening")
Set SummerSaturday = test.Controls("SummerSaturday")

If SummerWeekday.Value = True & Then
Item.Categories = Item.Categories & ",SummerWeekday"
ElseIf SummerEvening.Value = True & Then
Item.Categories = Item.Categories & ",SummerEvening"
Else SummerSaturday.Value = True & Then
Item.Categories = Item.Categories & ",SummerSaturday"

End If
End Function

Thanks.


Ads