EditDocument problem in LotusScript

Greetings,

I’m having some interesting trouble with the uiws.EditDocument function in LotusScript. Here’s the code I’m using:

=========================================

Sub Querysave ( Source As NotesUIDocument, Continue As Variant )

Dim uiws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument	

Dim doc As NotesDocument



Set doc = Source.Document.ParentDatabase.GetView ( "PatByAcct" ).GetDocumentByKey ( Source.Document.AcctNum (0) )



If Not ( doc Is Nothing ) Then

	Msgbox "A profile already exists for this patient!  Press Ok to switch to the existing profile.",_

	MB_OK + MB_ICONINFORMATION, "Profile already exists!"

	Source.Document.SaveOptions = "0"

	continue = False

	Call Source.Close

	

	Call uiws.EditDocument ( False, doc )	

End If

End Sub

=========================================

The code basically looks to see if the profile exists (based on a unique ID, the AcctNum) and if it exists, I want to drop the user on the existing document.

The problem is that the EditDocument doesn’t open the existing document AT ALL. No errors are triggered; the code simply ends without opening the new document.

Here’s the catch…while the LS Debugger is active, the code works perfectly. As soon as I turn the debugger off, it stops working.

Any ideas would be most appreciated.

Dave

Subject: Try using this Source.Close(True)

Call notesUIDocument.Close( [ immediate ] ) Parameters

immediate

Boolean. Optional. If True, the document is immediately closed. The default is False.

Note This parameter is new with Release 6.

Subject: EditDocument problem in LotusScript

You mean to say you haven’t read Andre’s article on testing and debugging? For shame!

What you’re possibly seeing here is a compilation issue. You can read more about this here:

http://www-10.lotus.com/ldd/today.nsf/0/a55740873b33ca2585256d4e005d2586

… but check the NotesUIWorkspace.EditDocument arguments in full for more too…