例: フォームにアクセスする

  1. 次の例ではフォームのプロパティを表示します。
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim form As NotesForm
      Set db = session.CurrentDatabase
      Set form = db.GetForm(Inputbox("Name of form?"))
      Messagebox "Name: " & form.Name
      If Not Isempty(form.Aliases) Then
        Forall aliaz In form.Aliases
          Messagebox "Alias: " & aliaz
        End Forall
      End If
      If form.IsSubForm Then Messagebox "Is a subform"
      If form.ProtectReaders Then
        Messagebox "Readers are protected"
      Else
        Messagebox "Readers are not protected"
      End If
      If Isempty(form.Readers) Then
        Messagebox "No readers"
      Else
        Forall reader In form.Readers
          Messagebox "Reader: " & reader
        End Forall
      End If
      If Isempty(form.FormUsers) Then
        Messagebox "No form users"
      Else
        Forall formuser In form.FormUsers
          Messagebox "Form user: " & formuser
        End Forall
      End If
      Forall field In form.Fields
        Messagebox "Field: " & field
      End Forall
    End Sub
  2. 次の例では、指定された名前を現在のデータベースのフォームの名前と比較することによって、フォームの存在を確かめます。
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Set db = session.CurrentDatabase
      formNameIn = Lcase(Inputbox("Name of form?"))
      Forall form In db.Forms
        If Lcase(form.Name) = formNameIn Then
          Messagebox _
          "The form """ & formNameIn & """ exists"
          Exit Sub
        End If
      End Forall
      Messagebox _
      "The form """ & formNameIn & """ does not exist"
    End Sub