|
|
|||
| Outlook Form Design Printer Friendly Version | |||
|
|
Designing custom Outlook forms and form regions and writing code for them | ||
| Topic | |||
|
|
More fun with Keywords
Hi Sue, I like the new skin, it has a more professional look and feel. I am using a keywords field in a form again (!). This is to store departments within the company who have been allocated a proportion of the cost. It works in the background so the user cant see it. They just enter a % in one or more fields and the custompropertychange sets the appropriate member of the "Selected" collection of the list box to true. The list box being bound to my keywords field. I have done this because I like the way you can group by the individual elements of a keywords field in a folder view. Very easy for a particular department to view all those they have a cost for. My problem is that allthough setting the olist.Selected(i) = True does visibly make the selection appear and the control is bound it doesnt actually change the value of the bound field!! Strange but true. Is ther another way to programtically add to the selected keywords? Simon Breeze 15-May-2007 04:54 |
||
|
|
Simon Breeze
15-May-2007 05:03
I am sure the new functionality is good too, I didnt mean to imply it was just the UI you updated. |
||
|
|
Simon Breeze
15-May-2007 06:34
I am doing it again, answering my own question. Using a text box as a mediator (binding the text box to the field) for a keywords field gives you two ways of manipulating it. either manipulate the string value using instr or put it in an array using split. I am not sure if this is the most eloquent but here is my string based solution. The premise is that sname is the name of a numerical custom field that has just been changed as well as the keyword you want to add/remove. It is trigered by Item_CustomProprtyChange sub SetSite(sname) dim oText dim sText Set oText = item.getinspector.modifiedformpages _(tabsettings).controls("txtAllocate") sText = oText.Value 'If it is already selected If instr(sText, sname) > 0 then 'If the triger field is 0 then remove it If userProperties(sName).Value = 0 then 'Also remove the separator if found sText = Replace(stext, sname & ";", "") stext = Replace(stext, sname, "") End If Else 'Keyword not already selected If UserProperties(sname).value > 0 then If len(stext)> 0 then 'Include a separator stext = stext & ";" & sname Else 'Sole Selection sText = sname End if End if End if oText.Value = stext End sub |
||
|
|
Sue Mosher
15-May-2007 06:51
That's a clever solution! I've sometimes been so frustrated with these little devils that I've resorted to an unbound list box. I like your way better. Glad you like the new look. Play around with the My OutlookCode and Manage My Settings features on the home page. |
||
|
|
|||
