Remove a value from a multi-value field

The code below will remove the value of the username variable from the Members field in the group document in the nab.

Dim gdoc As notesdocument
Set gdoc = gview.getdocumentbykey("GroupName")
Dim item As NotesItem
Set item = gdoc.GetFirstItem("Members")
Dim values As Variant
values = item.values
Dim newvalues() As String
If Ubound(values) = 0 Then
	Redim newvalues(0) As String
	Redim newvalues(0 To Ubound(values) -1) As String
End If
Dim x As Long
x = 0
Forall v In values
	If v <> username Then
		newvalues(x) = v
		x = x + 1
	End If
End Forall
Call item.Remove
Set newItem = New NotesItem(gdoc, "Members", newvalues, NAMES)
Call, True)

Posted by fbrefere001 on Monday March 10, 2003