Sub Querysave(Source As Notesuidocument, Continue As Variant) Dim lupV As NotesView ' view to search for duplicate e-mail Dim lupCol As NotesDocumentCollection ' collection of docs matching e-mail Dim lupDoc As NotesDocument ' doc matching e-mail in this document Dim lupkey As String ' lookup key - MailAddress Dim duplicates As String ' list of duplicate names ' start success Continue = True ' setup Set lupV = db.Getview("($Users)") lupkey = doc.MailAddress(0) Set lupCol = lupV.GetAllDocumentsByKey(lupkey ) Set lupDoc = lupCol.GetFirstDocument() While Not (lupDoc Is Nothing) ' this is the unique key, please change it if you need If (lupDoc.UniversalID = doc.UniversalID) Then ' skip Else ' gather duplicate info If (duplicates = "") Then duplicates = LSConvertName(lupDoc.FullName(0), "cn") Else ' append duplicates = duplicates & "|" & LSConvertName(lupDoc.FullName(0), "cn") End If End If Set lupDoc = lupCol.Getnextdocument(lupDoc) Wend If Not (duplicates = "") Then Msgbox "The following contact(s) have the same primary business e-mail address and are duplicates" & duplicates,,"Duplicate Name(s)" Continue = False End If End Sub Function LSConvertName(origstr As String, formatstr As String) As String ' converts NotesName formats ' origstr - string being converted ' formatstr - format desired, e.g. cn=common name, abbrev=abbreviated, canonical=canonical Dim tmpName As NotesName ' name object for conversion Set tmpName = New NotesName(origstr) If (tmpName Is Nothing) Then ' cancel out, return origstr LSConvertName = origstr Exit Function End If Select Case formatstr Case "cn" LSConvertName = tmpName.Common Case "abbrev" LSConvertName = tmpName.Abbreviated Case "canonical" LSConvertName = tmpName.Canonical Case Else ' bad format type passed, return origstr LSConvertName = origstr End Select End Function