I have a button on a main document that opens a Dialobox with another form. Inside this form a ‘search button’ perform an ldap search of names.
When this form is opened as a form itself, the search returns the correct results. When a search is made inside the dialogbox the search does not work properly.
The search code works fine because I have used it elsewhere without problems. But below is the code for how the search is made:
Sub Click(Source As Button)
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim agent As NotesAgent
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim searchResultItem As NotesItem
Dim paramid As String
Set db = s.CurrentDatabase
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set agent = db.GetAgent("(LDAPSearchWithFilter)")
Call doc.save(True, False)
paramid = doc.NoteID
Call agent.RunOnServer(paramid)
Delete doc
Set doc = db.GetDocumentByID(paramid) ' retrieve the back-end document
'Get the updated field
Set searchResultItem = doc.getFirstItem("HiddenSearchResults")
Forall values In searchResultItem.Values
Call uidoc.FieldAppendText("SearchResults", values)
' Add comma, so results in HiddenSearchResults field
' can be made a textlist
Call uidoc.FieldAppendText("SearchResults", ", ")
End Forall
Call uidoc.Refresh
End Sub