Examples: Open method

  1. This script opens the first database found on the current computer (local machine if the script runs on a workstation, server if the script runs on a server).
    Dim directory As New NotesDbDirectory( "" )
    Dim db As NotesDatabase
    Set db = directory.GetFirstDatabase( DATABASE )
    Call db.Open( "", "" )
  2. This LotusScript® agent opens each database in the AddressBooks property of NotesSession. The NotesDatabase variable, book, must be treated as a Variant to be used as an AddressBooks element.
    Sub Initialize
      Dim s As New NotesSession
      Forall book In s.AddressBooks
        book.open "", ""
        Messagebox book.Title,, "Address book"
      End Forall
    End Sub
  3. This Visual Basic code opens each database in the AddressBooks property of NotesSession. The NotesDatabase variable, book, must be treated as a Variant to be used as an AddressBooks element.
    Private Sub Open_Click()
    Dim s As New NotesSession
    s.Initialize
    For Each book In s.AddressBooks
      book.Open
      List1.AddItem (book.Title)
    Next
    End Sub
  4. This script opens the SALES.NSF database on the server HongKong.
    Dim db As New NotesDatabase( "", "" )
    Call db.Open( "HongKong", "sales.nsf" )
  5. This script tests for the existence of a specific database. You have a script that archives documents from one database to an archive database. If the archive database doesn't exist, the script creates it; otherwise, the script opens it.
    Dim archiveDb As New NotesDatabase( "", "" )
    Dim originalDb As New NotesDatabase( "", "product.nsf" )
    Dim collection As NotesDocumentCollection
    Dim doc As NotesDocument
    If ( Not ( archiveDb.Open( "", "archive\" &  _
    originalDb.FileName ) ) ) Then
      Set archiveDb = originalDb.CreateCopy( "", "archive\"  _
      & originalDb.FileName )
      Call archiveDb.GrantAccess( "Ivan Ash", ACL_MANAGER )
    End If