QueryOpen (NotesUIDocument - LotusScript®)

Occurs just before the current document is opened.

Defined in

NotesUIDocument

Syntax

QueryOpen( Source as NotesUIDocument, Mode as Integer, IsNewDoc as Variant, Continue as Variant )

Parameters

Source

NotesUIDocument. Read-only. The current document.

Mode

Integer. Read-only. 0 indicates that the user is opening the document for reading. 1 indicates that the user is opening the document for editing.

IsNewDoc

Boolean. Read-only. True indicates that the user is creating a new document. False indicates that the user is opening an existing document.

Continue

Boolean. Read-write. Indicates whether or not the document will open. Initially set to True. Set this parameter to False if you do not want the document to open.

Usage

When you create a script that responds to this event, Domino® creates the syntax of the event for you (including the parameters). You do not need to type it in.

Because the event occurs before the document opens, you cannot use the Source argument to do "front end" operations such as setting field values.

For an existing document (IsNewDoc = False), you can use Source.Document to get the back-end NotesDocument, and use that to read or assign fields. If you assign fields, it is not necessary to save the NotesDocument because the new values will be visible when the form opens.

However, if the form is opened by a compose operation (IsNewDoc = True), there is no back-end document, so Source.Document returns "Nothing." To assign fields in a document being composed, use the PostOpen event or the fields' Default value formulas.

The Queryopen event is not a security feature. To control access to information, use Readers fields, Authors fields, and field-level encryption - not event code or hide formulas.

If you use Queryopen as a way of restricting access to the document contents, it is easy for users to view the field information in other ways. For example, a user can open the Document Properties infobox from a view, or copy the document to a local database where they are the manager, or use the LotusScript® debugger to abort the Queryopen processing.

Example