Public Function GetLessee(Acct As String) As String
'Returns name of accountholder, if no last name then use company name.
If gbErrorTrapOn Then On Error GoTo ErrorTrap
Dim rs As ADODB.Recordset
If ExecProc("cash", "cash_GetLessee", rs, -1, Acct, gsCountry) Then
If Not rs.EOF Then
If Len(Trim(rs!last_nme)) > 0 Then
GetLessee = IIf(IsNull(rs!first_nme), "", Trim(rs!first_nme)) & " " & _
IIf(IsNull(rs!last_nme), "", Trim(rs!last_nme))
Else
GetLessee = IIf(IsNull(rs!company_nme), "", Trim(rs!company_nme))
End If
End If
Else
GetLessee = "Unavailable"
End If
Exit Function
ErrorTrap:
ShowError("GetLessee", Err.Number, Err.Description)
End Function |