Function LSDbLookup(s As NotesSession, dbname As String, vname As String, namekey As String, targetfldname As String) As Variant ' this function retrieves a document from the database (db) in a specified view ' this function returns the resulting values of the lookup ' Note: Adjust this lookup to return this by changing function return to variant. ' Then return tmparray rather than the first value of the array. Dim lupDb As NotesDatabase ' lookup database Dim lupV As NotesView ' lookup view Dim lupDoc As NotesDocument ' doc retrieved from lupV Dim lupItem As NotesItem ' the field to retrieve Dim tmpArray As Variant ' values of lupItem On Error Goto LUpErrorHandler Set lupDb=s.GetDatabase("", dbname, False) If (lupDb Is Nothing) Then ' return nothing LSDbLookup="" Exit Function End If Set lupV=lupDb.GetView(vname) If (lupV Is Nothing) Then ' return nothing LSDbLookup="" Exit Function End If Set lupDoc = lupV.GetDocumentByKey(namekey, True) If (lupDoc Is Nothing) Then ' return nothing LSDbLookup="" Exit Function End If Set lupItem = lupDoc.GetFirstItem(targetfldname) If (lupItem Is Nothing) Then ' return nothing LSDbLookup="" Exit Function End If tmpArray = lupItem.Values Exit Function LUpErrorHandler: ' return nothing LSDbLookup="" Exit Function End Function