"user defined error" on compose document

I’d like to compose new document in another database than in current dtb and close current document. My code on button action is here:

Sub Click(Source As Button)

On Error Goto ErrorHandler

Dim session As New NotesSession

Dim doc As NotesDocument

Dim uidoc As NotesUIDocument

Dim newUIDoc As NotesUIDocument

Dim db As NotesDatabase

Dim ws As New NotesUIWorkspace

Dim answer As Integer

Dim RequestPath As String



Set db = session.CurrentDatabase

Set uidoc = ws.CurrentDocument

Set doc = uidoc.Document



If uidoc.EditMode Then

	uidoc.Save	

	uidoc.EditMode = False		

End If





doc.fRequest = "Requested"

doc.fICTnotified="1"

RequestPath= GetSetting("fRequestpath")



If doc.fPC(0)="YES" Then

	answer = Messagebox("Do you want to create purchase request for PC?",4+32,"Question")

	If answer = 6 Then

		Call ws.SetTargetFrame("")

		Set newUIDoc = ws.ComposeDocument(db.Server,RequestPath,"frm_Requests_PO",,,True)

		

		Call newUIDoc.FieldSetText("fPurchaseLocation","B")

		Call newUIDoc.FieldSetText("fRequestType","ICT")

		Call newUIDoc.FieldSetText("Subject","PC for new employee "+doc.fFullName(0))

		Call newUIDoc.FieldSetText("fUnitPrice","1000")

		Call newUIDoc.Refresh(True)

	End If

End If



Call doc.Save(False,True)

uidoc.Close

ErrorHandler:

If Err=-28363 Then

	Resume 

End If

End Sub

If my current document is not in edit mode, new document in other dtb is composed ok, but if current document is being edited I am always getting the user defined error. it’s not error 28363 from post I found there

http://www-1.ibm.com/support/docview.wss?rs=899&context=SWD00&context=SWC00&context=SSKTVH&context=SSKTK9&context=SSKTKX&context=SSKTL5&context=SSKTM2&context=SSKTMJ&context=SSKTPA&context=SS5LUA&context=SSMT72&context=SSKTR9&context=SSKU24&context=SSKTTW&context=SSKTWB&context=SSKTWP&context=SSKTX4&context=SSKTYF&context=SSYSVG&context=SSKTZ5&context=SSKTZF&context=SS6PC5&context=SS6JT7&context=SSLJ3H&context=SSZHFR&context=SS6JUL&context=SSFLMV&context=SSYJJC&dc=DB510&dc=DB520&dc=D800&dc=D900&dc=DA900&dc=DA800&dc=DB530&dc=DA600&dc=DB550&dc=D100&dc=D600&dc=D700&dc=DA500&dc=D200&dc=DA430&dc=DA440&dc=DA410&dc=DA450&dc=DA420&dc=DA460&dc=DB300&dc=DA470&dc=DA110&dc=DA480&dc=DB100&dc=DA4A10&dc=DA4A20&dc=DA700&dc=DA4A30&dc=DA120&q1=user+defined+error+composedocument&uid=swg21091227&loc=en_US&cs=UTF-8&lang=en

My lotus is complete down.

Any ideas how to fix this?

help much appreciated

Subject: “user defined error” on compose document

if you close the document anyway, can’t you just put the document in read mode before composing another doc?

uidoc.editmode = false