I have some code in the exit function of a field on a document. When a person exists that field I want to do a dblookup to see if a document with the same criteria exists. I have put the @DBLookup formula in a button on the form using the formula language and it works. But, when using evaulate, I can not return anything. Can someone help me?
Code is this:
Sub Exiting(Source As Field)
Dim s As New NotesSession
Dim ws As NotesUIWorkspace
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim RepID As String
Dim enum As String
Dim creason As Variant
Dim tdate As String
Dim tlookup As String
Dim lookup789 As Variant
Set ws = New NotesUIWorkspace
Set db = s.CurrentDatabase
REM Get document used for passing data
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
enum = doc.EmployeeNumber(0)
creason = doc.DChangeReason(0)
tdate = doc.Date(0)
tlookup = enum + " - " + Cstr(creason) + " - " + tdate
Call doc.ReplaceItemValue("Lookup1", tlookup)
RepID = "852572E3:0056DE55"
lookup789 = Evaluate({@DbLookup( "" : "NoCache"; RepID ; "Admin\\789LookupView"; "}+ tlookup +{"; 11)})
' lookup789 = Evaluate(|@DbLookup( "" : "NoCache"; "| + RepID + |" ; "Admin\\789LookupView"; "| + tlookup + |"; 1)|)
If Isnull(lookup789) Then
mess = workspace.Prompt(PROMPT_OK, _
"Duplicate Entry", "The system already contains an entry with this inform. Once you hit okay, this document will close.")
Exit Sub
Else
End If
End Sub