Depending on the target of these lookups, they may result in an undesirable
performance hit. I've always wanted to optimize them so the lookups don't get
executed when the document is opened in Read mode. Lotus gives us a function
(@IsDocBeingEdited) to do exactly that. Just format your keyword formula as
@If(@IsDocBeingEdited; @DbColumn("" : ""; "ServerName":"DatabaseName";
"ViewName"; ColumnNumber); KeywordFieldName)
This formula does the lookup if the doc is in Edit mode or simply returns the
value that is currently in the keyword field if the doc is in Read mode.
Unfortunately, the formula does not evaluate when a doc was opened it Read mode
and is then changed to Edit mode. As a result, keyword choices are not
available in the particular scenario. This bug is well documented in Technote
Until I came up with a workaround, this bug prevented me from using
@IsDocBeingEdited because the side effects were unacceptable.
Just put the following code in the Querymodechange event of your form.
NOTE: If you need the same functionality on several forms, you could easily
create a new subroutine in a Script Library that contains the same code (You
will want to pass Source as a parameter).
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
If Source.EditMode Then
'User is going from Edit mode to Read mode. No action required.
'User had doc opened in Read mode, they are now switching to Edit
'Need this code to make the lookups work in this scenario.
Dim ws As New notesuiworkspace
Dim doc As notesdocument
Set doc = Source.Document
Call ws.EditDocument(True, doc)