uiw.EditDocument ==> "Invalid or nonexistent Document""

Dear All,

I have created a toolbar button whose click provokes a form to be opened. This form runs some code that allows me to create then to edit (open) a new calendar document.

Dim uiw As New NotesUIWorkspace

Dim db As New NotesDatabase(“”, “”)

Call db.openmail

Dim doc As NotesDocument

Set doc = db.CreateDocument()

'set a lot of Item to the document to make it a calendar document

Call doc.AppendItemValue(“ApptUNID”,doc.UniversalId)

Call doc.Save(True, False)

Call uiw.editDocument(True, doc)

This code is correct if I click on the button while there is no existing calendar entry selected in my calendar view.

However, if, when I click on the button, one existing calendar entry is selected in my calendar, the code raises these following messages:

“Invalid or nonexistent Document”

then

“Unable to find Document Window”

Do you know why the selection of an existing graphical calendar entry provokes EditDocument to fail with these error messages?

Please note that after these errors messages, the newly created document is opened correclty in the calendar view.

Thanks in advance for your support,

Mikaël Donini, Arkadin, France

Subject: uiw.EditDocument ==> “Invalid or nonexistent Document”"

Have you tried the debugger?

Call doc.AppendItemValue(“ApptUNID”,doc.UniversalId)

Call doc.Save(True, False)

you might have to save the doc before you append the universal id to the APPTUNID field.

so the code would be:

Call doc.Save(True, False)

Call doc.AppendItemValue(“ApptUNID”,doc.UniversalId)

Call doc.Save(True, False)

Subject: RE: uiw.EditDocument ==> “Invalid or nonexistent Document”"

Thanks Marjan, your answer solves the first error message. I do not know how you find this solution but congratulations …

But i have still the second message in the same context: “unable to find document window”

If you have any ideas …

In fact, I cannot use the debugger because the machine on which the problem is reproduced is a Macintosh OS and there is no Domino server (POP/SMTP protocol).

Mikaël.