LotusScript Open statement returns 'Unable to open file' error

Technote (FAQ)


When you execute a LotusScript Open statement, the following error is returned:

    "Unable to open file"

However, the file you are attempting to access is present within the Notes data directory.


When executed, the following agent produces the error even when the file "data.txt" is present within the data directory.
    Sub Initialize
    Dim filenum As Integer
    Dim filename As String

    filenum% = Freefile()
    filename$ = "data.txt"
    Open filename$ For Input As filenum%
    End Sub


By default, the Open statement searches for files within the Notes program directory (not the Notes data directory). The documentation does not clearly indicate that the Open statement searches the program directory by default. This documentation issue was reported to Quality Engineering as SPR #MGAN4DRS23 and has been addressed in Notes/Domino 6.0.

The documentation for the Open statement's Filename parameter now reads as follows:

A string expression indicating the file to open. fileName may include a complete path. If you do not specify a drive and a directory, LotusScript looks for the file in the default directory on the default drive. If you specify a drive but no directory, LotusScript looks for the file in the default directory of the specified drive. On platforms without drive letters, the default directory is used. If you specify a fileName that does not exist, LotusScript generates an error if the mode is Input; for all other modes, LotusScript creates the file and opens it.

If you would rather work with files stored in the data directory, you must specifically reference the data directory in your code.


fileName$ = ".\data\data.txt"

Rate this page:

(0 users)Average rating

Add comments

Document information

More support for:

IBM Notes

Software version:

6.0, 6.5, 7.0, 8.0, 8.5

Operating system(s):

Mac OS, Windows

Reference #:


Modified date:


Translate my page

Machine Translation

Content navigation