Weird NotesUIWorkspace.EditDocument behaviour

Hi,

I’ve got a simple database with a view and a form. Editing documents is done by using dialog boxes. Nothing special occurs.

One posibility to edit a document, is first to open it view mode an then to select an action simply calling workspace.EditDocument(True). In the Querymodechange I’m setting Continue to False and open the dialog box. After closing the dialogBox with the OK button I’m doing some checks and save the document and refresh the display by closing and reopening the document with EditDocument. If a test failed, I’m reopening the dialog box.

But when I want to edit an existing document, enter some invalid data (so the tests will fail an the dialog box is reopened) klick OK and then click Cancel (i.e. cancel all changes, nothing is saved), all changes are displayed in the refreshed form. … ??? Where do they come from? (And how can I avoid this?)

When I then close the form and reopen it with the same document, then everything is fine now and the unchanged document is shown.

The relevant code is:

Sub Querymodechange(Source As Notesuidocument, Continue As Variant)

Dim workspace As New NotesUIWorkspace

Dim doc As NotesDocument

If Not Source.EditMode Then

Continue = False

Set doc = Source.Document

...

editInPopup doc ....

Source.Close

workspace.EditDocument False, doc

End If

End Sub

Sub editInPopup (doc As NotesDocument,…)

Dim workspace As New NotesUIWorkspace

Dim DialogOkCancel, defined As Boolean

Dim ok As Boolean

Do

ok = True

DialogOkCancel = workspace.DialogBox( viewName, _

True, True, False, True, False, False, title, doc, True)

If DialogOkCancel = True Then

  ' ... do some tests and set ok to false it they fail

  If ok Then

    doc.Save False, False, True

  End If

End If

Loop While Not ok

End Sub

Does someone ever had a similiar problem or has someone got an idea?

Thx

A Ke