Consider the following scenario:
a lotus form containing an embedded view and an embedded editor, the 2 embedded controls are linked together according to targeting by linking an embedded editor to an embedded view.
The embedded editor contains a button that tries to get the current document (often called uidoc) with the code:
Sub Click(Source As Button)
Dim w As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = w.CurrentDocument
but this code returns the NotesUIDocument of the document linked to the embedded editor and not the NotesUIDocument linked to the main document.
To get the current document you have to:
- declare a global variable in the form of the embedded editor under (Globals) -> (Declarations)
Visual Basic1Dim uidoc As NotesUIDocument
- modify the event (Globals) -> Initialize where you initialize uidoc
Visual Basic1234567Sub InitializeDim w As New NotesUIWorkspaceSet uidoc = w.CurrentDocumentEnd Sub
Now the variable uidoc points to the current document and being a global variable you can use in the Click event of the button and in other parts of the embedded editor.