Switching doc to view mode

Problem with putting a doc from edit mode to view mode:

The user opens a document in edit mode and changes some fields. In the form agent bar I have a button to switch the document back to view mode. The user is then asked whether he wants to save his changes. So far everything is fine. After saving the document, the doc is closed but instead of the same doc some other document is then open in view mode.

The reason seems to be, that the edited document no longer is at the same position in the view. The doc that gets open in view mode is the doc that now ist display at the view position of the previous doc.

This can easily be reproduced by a view sorted by modification date and following code:

Formula:

@Command([EditDocument];“0”)

or Lotus Script:

Dim Wsp As New NotesUIWorkspace

Dim uiDoc As NotesUIDocument

Set uiDoc = Wsp.CurrentDocument

uiDoc.EditMode = False

any ideas?

Thanks

Markus

By the way:

Instead I tried using uidoc.close and then reopening the doc again. Yet the document closes after it is reopend and some values (cfd fields) are displaying wrong values… what a misery…

Subject: Closing and reopening

Try getting the document’s unique ID (UNID) using @DocumentUniqueID and reopening the document using @Command([OpenDocument];“0”;UNID).