Work around SendTo no longer found in name & address book

I have an agent that runs with the following line of code:

Memo.SendTo = Doc.fld_Responsible(0)

If the person listed in the field called fld_Responsible is no longer in the name & address book, I wasnt to skip it.

Where would I put the error check? Do I put it down by the Call Memo.Send line of code?

I did not write the code (and am not fluent with L/S at ALL!). Any assistance would be much appreciated!

Subject: work around SendTo no longer found in name & address book

Dim ns As New NotesSession	Dim ws As New notesuiworkspace

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim uidoc As NotesUIDocument

Dim ret As Variant

Dim key As String

Set db = ns.CurrentDatabase

Set uidoc = ws.CurrentDocument

Set doc = uidoc.Document

serv$ = db.Server

key = Lcase(doc.fld_Responsible(0))

ret = Evaluate (|@IsError(@DbLookup("":"NoCache"; "| + serv$ + |" :"names.nsf";"($Users)"; "| + key + |";1))|, doc)

If ret(0) = "0" Then

	Print "user found: mail the doc"

Else

	Print "user not found: don't mail the doc"

End If

Subject: RE: work around SendTo no longer found in name & address book

Or better yet:

ret = Evaluate (|@IsError(@DbLookup(“”:“NoCache”; “| + serv$ + |” :“names.nsf”;“($Users)”; fld_Responsible;1))|, doc)

Subject: RE: work around SendTo no longer found in name & address book

and be sure to lowercase fld_Responsible or the lookup won’t work since $Users view is all lowercase values.

Subject: RE: work around SendTo no longer found in name & address book

Awesome! I’ll post my results after I test it. Thanks for the response guys!

Subject: RE: work around SendTo no longer found in name & address book

Evaluating @namelookup should do the same thing, but faster.

Subject: RE: work around SendTo no longer found in name & address book

Thanks for this post. It solved a simliar problem for me!