I want to transfer the docs from a view in a database to other view in other database, so i have to copy and then to remove the docs, because the only option that notesdocument has is copytodatabase.
So i have this code:
Option Public
Option Declare
Sub Initialize()
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim dbB As New NotesDatabase(db.Server,"Desarrollo\Formular_CL02.nsf")
Dim vwA As NotesView
Dim vwB As NotesView
Dim docA As NotesDocument
Dim docB As NotesDocument
'Open the database
If Not (dbB.isopen) Then
Call dbB.open(db.Server,"Desarrollo\Formular_CL02.nsf")
End If
'Get the views
Set vwA = db.getView( "TestDevelop" )
Set vwB = dbB.getView( "TestDevelop" )
Set docA = vwA.GetFirstDocument
Do While Not( docA Is Nothing )
If docB Is Nothing Then
Call docA.CopyToDatabase(dbB)
Call docA.Remove(True)
End If
Set docA = vwA.GetNextDocument(docA)
Loop
End Sub
When i execute the agent at the end it shows me an error:
Function requires a valid ADT argument
If i remove the line about Call docA.Remove(True) the agent will copy all documents without error.
Any advice?
Thanks a lot!