@glombi: danke, aber ich benutze keien uiKlassen
aber hier jetzt mal das gesamte Script
Sub Initialize
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim db1 As NotesDatabase
Dim doc As NotesDocument
Dim doc1 As NotesDocument
Dim docB As NotesDocument
Dim col As NotesDocumentCollection
Dim subj As Variant
Dim subj1 As Variant
Dim ID_DA As Variant
Dim ID_O As Variant
Dim ID_DN As Variant
Dim Doc_ID As String
Dim NeueID As String
Dim CopyD_ID As String
Dim View_selection1 As String
Set db = session.CurrentDatabase
Set col = db.AllDocuments
Set doc = col.GetFirstDocument
While Not (doc Is Nothing)
subj = doc.GetItemValue( "Feld1" )
subj1 = doc.GetItemValue( "Feld2" )
'Dokument nach bestimmten Bedingungen
If subj(0) = "YES" Then
If subj1(0)="1" Then
'DB2 öffnen, hier gibt es, glaube ich die Probleme
Set db1 = New NotesDatabase("", "" )
Call db1.Open("","DB2")
If Not db1.IsOpen Then
Print "Die Datenbank DB2 konnte nicht geöffnet werden!!!"
Exit Sub
End If
'Dokument in DB2 suchen
Set doc1 = db1.GetDocumentByUNID( doc.GetItemValue ("CopyD_ID")( 0 ))
Call doc1.ReplaceItemValue ( "Doc_Deleted",1)
Call doc1.Save(True, False)
'Neues dok erstellen
Set docB = New NotesDocument( db1 )
Call doc.CopyAllItems( docB, True )
'Werte in neuem Dok setzen
ID_O = doc.GetItemValue( "Doc_ID" )
docB.DocO_ID= ID_O
docB.View_selection1="Wert setzen"
Call docB.Save( True, True )
Call docB.ComputeWithForm(False,False)
Call docB.Save( True, True )
ID_DN= docB.GetItemValue( "Doc_ID" )
doc.CopyD_ID= ID_DN
Call doc.Save( True, True )
End If
End If
Set doc = col.GetNextDocument(doc)
Wend
End Sub