Can someone please provide sample LotusScript for a button I can place on an open document [edit or read mode; doesn’t matter]. When clicked, a new document should get created and take focus. All the values from the original doc should be copied.
I know this is fairly simple, and I’ve scoured the Info Center, this forum, etc, and have come across several topics and threads but (i) my LotusScript skills are severely limited (ii) everything I’ve seen so far is a mix of code and pseudo-code and - of course - I don’t know what should go in the pseudo-code
Thanks
Subject: Try this
Add a button to your form and try this code:
Sub Click(Source As Button)
Dim ws As New notesuiworkspace
Dim db As notesdatabase
Dim thisDoc As notesdocument
Dim newDoc As NotesDocument
Dim uiNewDoc As NotesUIDocument
Set db = ws.CurrentDatabase.Database
Set thisDoc = ws.CurrentDocument.Document
Set newdoc = db.CreateDocument
Call thisDoc.CopyAllItems(newdoc)
Set uiNewDoc = ws.EditDocument(True,newDoc)
End Sub
Subject: Won’t work… 
There is quite a bit more to it than just copy all items on the form. I been mailing back and forth with Jeff, and he been giving me more information. There are fields in document counters/serial numbers, populated by agents running in PostOpen() that perform a lookup to get the next number, etc. Those numbers should not be copied, but instead new numbers should be generated…
That is why I asked all those questions in my initial response, most questions are not that easy to answer, as it is very uncommon that the initial post contains all the parameters. 
Subject: Not enough information.
You need to be more precise, and provide more details.
-
Has the document already been saved, i.e. does it exist in the backend?
-
Should/can the document be saved before the new document is created?
-
Do you requre the button to create a new document with the current values without updating the backend version of the open document?
-
Is the document a main document or a respons document?
Contact me offline at texasswede@gmail.com and we can discuss the details.