Domino Code Fragment

Code Name*
In one form, the user can select as many as three subforms from the list of all available subforms.
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.117.158.47
Description*
Where do we get a list of subforms when we don't know from one minute to the next how many there are or what they are called? Simple, we use this LotusScript routine
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:

Sub Postopen(Source As Notesuidocument)
   If Source.EditMode Then
   
        Dim session As New NotesSession
        Dim db As NotesDatabase
        Dim forms As Variant
        Dim formNames(200) As Variant
        Dim doc As NotesDocument


         Set db = session.CurrentDatabase
        forms = db.Forms
       i = 0
        Forall form In forms
             If form.IsSubForm Then
                  formNames(i) = form.Name
                  i = i + 1
             End If
        End Forall


         Set doc = Source.Document
        doc.subformList = formNames
        Source.Reload
   End If
End Sub