Examples: OpenDatabase method (NotesDbDirectory - LotusScript®)

This Visual Basic code opens a database in the local Domino® or Notes® directory.

Private Sub OpenDatabase_Click()
On Error GoTo errorHandler
Dim s As New NotesSession
s.Initialize
Dim dir As NotesDbDirectory
Dim db As NotesDatabase
Set dir = s.GetDbDirectory("")
Set db = dir.OpenDatabase("quack.nsf")
MsgBox db.Title, , db.FilePath
Exit Sub
errorHandler:
If Err.Number = ERR_SYS_FILE_NOT_FOUND Then
  MsgBox "File not found in Notes directory", , _
  "No quack"
Else
  MsgBox Err.Description, , Err.Number
End If
End Sub