If you would like to prevent any further editing of a document, do the following:
1. Create a text editable field called - LockEdit, give it a default value of "Unlock".
2. Create or add to your final action button the following code.
@SetField("LockEdit" ; "Lock");
3. Add the following code to Querymodechange event on the form.
Sub Querymodechange(Source As Notesuidocument, Continue As Variant) If Not ( source.EditMode ) Then currentStatus = source.FieldGetText( "LockEdit" ) If ( currentStatus = "Lock" ) Then Messagebox _ ( "Document available for reading only." ) continue = False End If End If End Sub
- There is an error in this coding. This only works when going from read mode to edit mode and this is not the case if an end user uses the edit smart icon or [ctrl E] to get into the document from a view. In either of those cases the document was never in read mode, so the querymodechange event never fires. To fix this problem the code also needs to be in an open event. Darin Dutcher
- This is regarding the Prevent Further Editing tip published on 9/23. There is one other piece that needs to be added. If a user opens the document using Ctrl-E, the QueryModeChange event does not trigger, yet the user is editing the document. So this save "LockEdit" code needs to be put into the QueryOpen event, to see if the document is being opened in Edit Martie Ripson