Ok, the physical location of the subform complicates things... The code was basically written for an existing subform from the calling database, and the extract only the document from the Domino Directory, edit it and save it BACK to the DomDir...
The opening of the database is these lines:
Dim db as New NotesDatabase(workspace.CurrentDatabase.Database.Server, NABName$)
' Check if it has been opened. If not, try to open it. If it fails again, exit the SUB
If (Not (db.IsOpen)) then
Call db.Open("", "")
if (Not (db.IsOpen()) then Exit Sub
End if
' Then find and open the current users document
Set userdoc = db.getView(ViewName).GetDocumentByKey(UName.Canonical, True)
if (Not (Userdoc is nothing)) then
...
Since your form is inside the Domino Directory, the next lines call will fail since your are INSIDE your maildb, and the subforms not available within this DB.
The 'FORMS' method will give access to the NotesForm class, or use the database method db.GetForm("<FormName>"), BUT this returns a NotesForm class, and can not be used in the dialogbox directly... It would have been ideal IF it could be COPIED from one database to another in the background (and removed again after use), but there are no available methods for this in default NotesDatabase, NotesDocument or NotesForm.
For access to the whole MAIN person form the following UI method can be used:
Set notesUIDocument = notesUIWorkspace.EditDocument( [editMode] , [notesDocument] , [notesDocumentReadOnly] , [documentAnchor$] , [returnNotesUIDocument] , [newInstance] )
BUT this will only open with the specified/stored form, so if this is a person document, the PERSON form will come up, no subform...
If you are using a TEMPLATE on mail databases (or where you trigger the button) you COULD have copied and added in the subform there, this WOULD probably be easiest, since there is no CREATEFORM or COPYFORM methods available in LotusScript. There is in the formula language, but that creates only an empty form.
So for remote use of external subforms it becomes a bit 'iffy'. One THEORETICAL alternative is to OPEN the NAMES.NSF and THEN trigger the subform, but there is a lot of potential pitfalls there.
Sorry...
Brgds,
TrooDOS