A "Database has not been opened yet" error occurs when you try to use a LotusScript NotesDatabase object in ways that require the database to be "open," and it is not open at that time. The IsOpen property will tell you whether the database is open. See the description of IsOpen for a list of properties that are available when the database is not open.
If you get the NotesDatabase handle from a NotesDBDirectory object or from NotesSession.AddressBooks, it is not open until you call the Open method on it. But if you get the object in another way, for example, using New NotesDatabase with non-blank server and filepath arguments, the database is normally opened at the same time.
The cause of the problem is the line of code that creates the NotesDatabase object. However, the error does not occur until later when you try to use the object in a way that requires it to be open.
Dim dbLookup As New NotesDatabase(dbThis.Server, "folder\lookup.nsf") ' problem is here: database does not exist
Set view = dbLookup.GetView("Keywords") ' error occurs here
Possible causes of the problem are:
- There is no such database at the path you specified.
- The ID running the code does not have access to open the database.
- The database file is damaged and cannot be opened.
When specifying server name, "" (empty string) may only be used when the database is local to the computer executing the code.
If the code runs on the server (for instance, a scheduled agent), you should use "" for other databases on the same server.
If the code is run from a workstation, a server name of "" can only find databases stored locally on the workstation. This is true even if the code is stored on the server -- for instance, if a user uses the Actions menu to execute an agent in a server replica of an application. The question is not, where is the code stored, but which computer is running it?
The full filepath (e.g. "C:\notes\data\r_apps\haha.nsf") may optionally be used when accessing local databases on a workstation. If you specify a server name, however, or if the code is running on a server, you must use the path relative to the Notes data directory ("r_apps\haha.nsf"). This is a security feature.
Resolving The Problem
Notes is working as designed.
Use the LotusScript debugger, or insert some debugging output statements, to see the exact values of the strings you're passing as arguments. Make sure they have the values you expect. If the values are correct, try to open the application manually from the Notes client menus using the exact same server name, filepath and Notes userID that is used by the code. The resulting error message should tell the cause of the failure.
Internal Use OnlyThis is a problem with the design of the Lotus Notes application. Please contact the application developer or your local support organization.
16 June 2018