Is it possible, in LotusScript, to copy a form object from one database to another? OR, alternatively, to create a new NotesForm object and copy items from a form object in another database?
TIA
--Bill
Software/Hardware used:
ASKED:
November 19, 2005 8:36 PM
UPDATED:
November 23, 2005 5:18 AM
yes, you just have to create an instance pointing to the object in question.
example…note that i didn’t write all the code, and you’ll have to instantiate some of the views, document and items, but the general idea is there.
Dim dir As NotesDbDirectory
Dim db As NotesDatabase
Dim db2 As NotesDatabase
Set dir = s.GetDbDirectory(“”)
Set db = dir.OpenDatabase(“dbpath.nsf”)
set db2 = dir.OpenDatabase(“dbpath.nsf”)
‘get 1st item in document(source)..let’s assume it’s doc.
‘and item is the item from the doc
…
set pointerToField = doc.item
‘declare a new document from the other database and
‘create a new object and copy that object or convert it ‘through a dummy variable
pointerToField.CopyItemToDocument(newDoc,newItem)
…
Depends what you actually want to do? If you want a simple way of re-creating a form that exists in one database in another distinct database. Highlight the form(s) in the original database?s form view and press Ctrl+C, then open the other database, again in forms view, and press Ctrl+V. This gives you the option of template sharing from a standard ntf database.
Alternatively, as with response 1, mt69, you can do it programmatically using the NotesNoteCollection class ? see Designer help.