In an application I'm working on now, from a given document - a Claim, I need to look up a value on a connected document, a Partner.  In this application there is a function to do just that, fetch a Partner document based on a value in Claim;  The code snippet looks like this:

       'is the partner tax exempt?  
       Dim ClientInsurer As NotesDocument
       Set ClientInsurer = GetPartnerDoc(claim.ID_ClientInsurer(0))
       If ClientInsurer Is Nothing then

And when this is run, ClientInsurer is invariably Nothing.  

GetPartnerDoc looks like this:

Function GetPartnerDoc(IPCode As String) As NotesDocument
       Dim pDB As NotesDatabase, insurers As NotesView
       Set pDB=GetPartnersDB
       Set Insurers=pDB.GetView("LookUpIPCode")
       Set GetPartnerDoc=Insurers.GetDocumentByKey(IPCode,True)
End Function

When I look at this with the debugger, I can see that the last line of getPartnerDoc populates getPartnerDoc with a NotesDocument data type, and it is indeed the partner document that I want - getPartnerDoc seems to work OK.   Yet that value, that I can see ready to go when it's executed the last line of GetPartnerDoc doesn't get back in to ClientInsurer in the invoking code.  How strange is that?

I've bypassed it by replacing the call to GetPartnerDoc with a direct lookup to the same view, and that works just fine.

Btw:  this is with Designer 8.5.1 FP1, Notes 851FP1 client and a Donino 851FP1 server.  However when the code runs on a 7.0.something server, it also generates the same erroneous result.  

Comments (9)
Mick Moignard March 11th, 2010 09:42:02 AM