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