0
votes

I have an issue I don't quite understand and I'm struggeling with it for quite a while now.

From an existing document I want to create a new document (same DB different form). I use a button inside this form.

Sub Click(Source As Button)
    Dim ws As New NotesUIWorkspace
    Dim thisProject As New kitcProject() '// this only wraps the current document
    Set NREDOC = thisProject.newNREdocument() '// this returns a NotesDocument, that has not been saved yet
    Call ws.EditDocument(False, NREDOC, False, "", True, False)
End Sub

This is not working, it does not open the document unless I save it first before using the EditDocument call

    Call NREDOC.Save(true, false)

I have a similar button function that works fine with a document from another database, that is also in unsaved state when opening it with the EditDocument call.

Here is the function that returns the NREDOC

%REM
Function newNREdocument
Description: Returns a new NotesDocument prefilled of type NRE
%END REM
Public Function newNREdocument() As NotesDocument
    Set me.nreDoc = db.Createdocument()
    With me.nreDoc
        .Form = "NRE"
        .nreProjectID = me.uidocument.FieldGetText("prProjectID")
        .nreProjectName = me.uidocument.FieldGetText("prProjectName")
    End with
    Set newNREdocument = me.nreDoc
End Function

Checking the NREDOC in Debug Mode tells me that there is nothing wrong with the document, ParentDatabase is set correctly, all the prefilled values are set, but it won't open. What am I doing wrong?

Is there some flag to be set in the form properties maybe? I have no further ideas

Thanks for your help in advance.

2
I have no idea if this is your problem, but I notice that you're setting the returnNotesUIDocument parameter to true, but you're using a Call statement rather than using a Set statement and invoking EditDocument as a function. That seems like a bad thing to do. - Richard Schwartz
I was testing with the parameter set to false and true, makes no difference - Edwin Krause

2 Answers

1
votes

I found the solution. The key here is the newInstance flag at the end

Call ws.EditDocument(True, NREDOC, False, "", False, True)

Setting the flag to True solved my issue. Unfortunatelly that was the last flag I was playing around with.

0
votes

You could also make the new document show up in a DialogBox, so everything stays on the same screen and access to the first document is blocked. The only thing different there would be way to save the new document. Quite interesting actually...