Categories
Lotus

Getting the current document from a button in an embedded editor

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

End Sub

but this code returns the NotesUIDocument of the document linked to the embedded editor and not the NotesUIDocument linked to the main document.