developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 4 and 5 Forum

Notes/Domino 4 and 5 Forum

developerWorks




help on copytodatabase method
David Johnson 03/07/2001 04:04 PM
Domino Designer -- LotusScript 4.6.5c Windows NT


I've created a Lotus Script agent to copy documents from DB A to DB B. The documents that need to be copied are listed in a view called "maintenance". When this agent runs only the first document in the view is copied to DB B. I would like all the documents listed in this view to be copied to DB B. Is there anything I'm missing in the code? Please help!

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim Db2 As New NotesDatabase("","purchase.nsf" )
Dim view As NotesView
Set db = session.CurrentDatabase
Set view = db.GetView("Maintenance")
Set doc = view.GetFirstDocument

While Not (doc Is Nothing)
Call doc.Save(True, False)
Call doc.CopyToDatabase(db2)
Set doc = view.GetNextDocument(doc)
Wend

Go back