1

Тема: Перенос документов с базы1 в базу2.

Правильный перенос документов с базы1 в базу2 из определенной вьюхи.

Sub Click(Source As Button)
    On Error Goto ErrH
    Dim session As New NotesSession    
    Dim db As NotesDatabase, workdb As NotesDatabase
    Dim view As NotesView
    Dim doc As NotesDocument, newdoc As NotesDocument
    Dim server As String
    
    Set db = session.CurrentDatabase
    server = db.Server
    Set view=db.GetView("lostrep")
    Set workdb = New NotesDatabase( server, "documents2.nsf" )
    
    Set doc = view.GetFirstDocument
    While Not (doc Is Nothing)
        
        Set newdoc=workdb.CreateDocument        
        Call doc.CopyAllItems(newdoc,1)
        newdoc.UniversalID=doc.UniversalID
        Call newdoc.Save(True,False)
        Call doc.Remove(False)    
        Set nextdoc = view.GetFirstDocument
        Set doc=nextdoc
        Set nextdoc=Nothing
    Wend
    
    Exit Sub
ErrH:
    Print "Ошибка: " & Error(Err) & " в строке " & Erl
End Sub

Поделиться