View Single Post
  #2  
Old June 27th 07, 03:25 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Setting a Category

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