uidoc.Close problem

See code below. Any help will be a great News Year present.

Sub Click(Source As Button)

%REM

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

This script is under a document button

Call uidoc.Close problem, see Problem #1 below

Also Call docB.GotoField fails, see Problem #2 below

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

%END REM

'CREATE REVISED QUOTE FROM a QUOTE being viewed on the screen by the user

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument



Dim session As New NotesSession

Dim db As NotesDatabase

Dim docA As NotesDocument   'Quote Email Document

Dim docB As NotesDocument  'New Quote with Revision letter	



Set uidoc = ws.CurrentDocument

uidoc.EditMode = True   'put Quote Email Document in edit mode.  The user may not be in edit mode when they click Create Revised Quote

Set docA = uidoc.Document



Set db = session.CurrentDatabase

Set docB = New NotesDocument( db )



Call docA.Save( True, True )   '======================





On Error Goto THEEND







Call uidoc.Refresh  'Refresh the Quote Email Document so all values are current

Call docA.CopyAllItems( docB, True )   'copy all the values of Quote Email Document into new Quote Document

docA.Flag_UsedForRevision = 1  'tag this document so it cannot be used again for a revision.  Also used in view selections

docA.AllowRevQuoteFromThisQuoteEmail = 1 'mark this Quote Email document so it can not be used to Create Package again





docB.form="Quote"		

docB.QuoteRev = docA.QuoteNextRev(0)

docB.QuoteEmailStatus = ""



Call docA.Save( True, True)

docA.SaveOptions = "0"	

Call uidoc.save 

uidoc.EditMode = False   'switches current docA on screen to read mode

Call uidoc.Close(True) 'closed immediately

'P R O B L E M #1 - The uidoc is still open on the screen while the docB is in edit mode per the ws.EditDocument below

Call docB.Save( True, True )

Messagebox "Revised Quote has been created"

ws.EditDocument True, docB , False  'open the Quote docB

Call docB.GotoField("Date01")	  'P R O B L E M #2 - the cursor does not go to the field Date01

THEEND:

Exit Sub

End Sub

Subject: uidoc.Close problem

I have also experienced the problem where uidoc.close(true) does NOT immediately close the ui document. I don’t have a solution for that problem for you.

However, problem #2 is because docB is a NotesDocument, and GotoField is a NotesUIDocument method.

Try

dim uidocB as NotesUIDocument

then after your message box

set uidocB = ws.EditDocument( True , docB ) ’ the third parameter is not required

call uidocB.GotoField( “Date01” )

Subject: RE: uidoc.Close problem

Thank you Michelle. I tried your solution for Problem #2 and it worked. Anyone know about Problem#1? Happy New year to all.

Subject: RE: uidoc.Close problem

Just a guess, but docA is no longer the current doc:

ws.EditDocument True, docB , False 'open the Quote docB

Then your uiDoc method on docA won’t work.

Try this:

ws.EditDocument True, docA , False 'open the Quote docB

Call uidoc.Close(True) 'closed immediately

ws.EditDocument True, docB , False 'open the Quote docB

There will be a flash on the screen but it should do what you want.

Shawn