AppendToTextList can only be used to append a text value to a field and AppendItemValue does not replace the item. Instead, it creates another item of the same name, and gives it the value you specify.
Especially when you want to append a date values ( variant ) to a multivalue date field, you cannot use the AppendToTextList since it covers the date value to a string and neither can you use the AppendItemValue because of the above limitation. The function below is used to append text/non-text values to a field.
Pass the document handle, the field name to which you want to append the value and the actual value that you want to append to the function.
Function AppendValues( doc As NotesDocument, fieldName As String,
newValue As Variant ) As Integer ***************************************************************** ' Author : Kiran ' Purpose : This function is used to append text/non text values to the any given fieldName '**************************************************************** On Error Goto err_Handler If doc.HasItem( fieldName ) Then If doc.GetItemValue( fieldName ) ( 0 ) = "" Then Call doc.ReplaceItemValue( fieldName, newValue ) Else Call doc.ReplaceItemValue( fieldName, Arrayappend(
doc.GetItemValue( fieldName ), newValue ) ) End If AppendValues = True End If Exit Function err_Handler: AppendValues = False Resume ok_Exit ok_Exit: End Function
This was first published in June 2002