Function GetPersonFldVal(s As NotesSession, db As NotesDatabase, usernm As String, fldnm As String) As String ' gets field value (as text ) of field on person doc Dim nDb As NotesDatabase ' names.nsf Dim nV As NotesView ' person users view Dim nDoc As NotesDocument ' person doc Dim nFld As NotesItem ' field wanted for .Text value On Error Goto FErrorHandler Set nDb = s.GetDatabase(db.Server, "names.nsf", False) If (nDb Is Nothing) Then 'give up GetPersonFldVal = "" Print "Cannot get Domino directory to get person doc for " & usernm & "." Exit Function End If If Not (nDb.IsOpen) Then ' probably cannot due to access but try anyway Call nDb.Open(db.Server, "names.nsf") If Not (nDb.IsOpen) Then GetPersonFldVal = "" Print "Cannot open/access Domino directory to get person doc for " & usernm & "." Exit Function End If End If ' have domino directory, get person user view Set nV = nDb.GetView("($Users)") If (nV Is Nothing) Then GetPersonFldVal = "" Print "Cannot get $Users view in Domino directory to get person doc for " & usernm & "." Exit Function End If ' have view, get user doc Set nDoc = nV.GetDocumentByKey(usernm) If (nDoc Is Nothing) Then ' user not found, give up Print "Could not find user, " & usernm & ", in $Users view in Domino directory to get person doc." Exit Function End If ' have person doc, get field Set nFld = nDoc.GetFirstItem(fldnm) If (nFld Is Nothing) Then ' field not found, give up Print "Could not find field, " & fldnm & ", in person doc in Domino directory." Exit Function Else ' return field value GetPersonFldVal = nFld.Text End If ' done FExit: Exit Function FErrorHandler: Print "(GetPersonFldVal) Unexpected Error: " & Cstr(Err) & " " & Error$ & ", on line: " & Cstr(Erl) GetPersonFldVal = "" Exit Function End Function