Copy Code
|
|
---|---|
Private Function MultiBugFieldValues(bugObject As Bug, _ Optional theField As String = "BG_USER_01") _ As Boolean ' Get and assign multiple values for a Bug record On Error GoTo FUNC_ERR Dim BugBaseField2 As IBaseField2 Dim MultiV As MultiValue Dim MVList As TDAPIOLELib.List Dim aVal As Variant Debug.Print "Initial multi-value field" ' Cast the Bug object to get an IBaseField2 reference ' from which to get the MultiValue object. Set BugBaseField2 = bugObject Set MultiV = BugBaseField2.FieldMultiValue(theField) ' Get the text. Debug.Print "MultiV.Text: " & MultiV.Text ' Emma;Mansfield Park;Northanger Abbey ' ' Get the List. Set MVList = MultiV.List For Each aVal In MVList Debug.Print aVal ' Emma ' Mansfield Park ' Northanger Abbey Next ' Enter new values in the MultiValue object. MultiV.Text = "Sense and Sensibility;Pride and Predjudice;Persuasion" 'Use the MultiValue object to assign the new values to the bug record. BugBaseField2.FieldMultiValue(theField) = MultiV bugObject.Post Debug.Print "Modified multi-value field" ' Get the modified list. For Each aVal In MVList Debug.Print aVal ' Persuasion ' Pride and Predjudice ' Sense and Sensibility Next MultiBugFieldValues = SUCCESS Exit Function FUNC_ERR: MultiBugFieldValues = FAILURE End Function |