Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: Thunder am 22.04.04 - 18:30:13
-
Wie bekomme ich es hin, ein derzeit geöffnetes Dokument, welches noch bearbeitet wurde und noch nicht gespeichert ist in eine andere DB zu kopieren ?
Mit folgendem Script kopiert er die neuen Änderungen nicht mit.
Setze ich einen 'Call olddoc.save (true,true)' dazwischen - wird gar nichts kopiert.
:(
Sub Initialize
Dim ws As New notesuiworkspace
Dim s As New notessession
Dim db As notesdatabase
Dim olddoc As notesdocument
Dim newdic As notesdocument
Set db = s.getdatabase ("S155LN03","Kredit\Aktenanforderung (Archiv).nsf")
Set olddoc = ws.currentDocument.Document
Set newdoc = olddoc.copytodatabase(db)
End Sub
-
So:
Sub Initialize
Dim ws As New notesuiworkspace
dim uidoc as NotesUIDocument
Dim s As New notessession
Dim db As notesdatabase
Dim olddoc As notesdocument
Dim newdic As notesdocument
set uidoc = ws.CurrentDocument
call uidoc.Save
Set db = s.getdatabase ("S155LN03","Kredit\Aktenanforderung (Archiv).nsf")
Set olddoc = uidoc.Document
Set newdoc = olddoc.copytodatabase(db)
End Sub
-
Besten Dank !
-
Aber warum klappt das nicht ? - Hier wird wieder nix kopiert.
Sub Click(Source As Button)
Dim ws As New notesuiworkspace
Dim uidoc As NotesUIDocument
Dim s As New notessession
Dim db As notesdatabase
Dim olddoc As notesdocument
Dim newdic As notesdocument
Set uidoc = ws.CurrentDocument
Call uidoc.fieldsettext ("Status", "Aktenlager")
Call uidoc.fieldsettext ("Aktenort", "Aktenlager")
Call uidoc.Save
Set db = s.getdatabase ("S155LN03","Kredit\Aktenanforderung (Archiv).nsf")
Set olddoc = uidoc.Document
Set newdoc = olddoc.copytodatabase(db)
Call uidoc.close
End Sub
-
Ich habe nicht viel Zeit - der Grill wartet ;D
Sub Click(Source As Button)
Dim ws As New notesuiworkspace
Dim uidoc As NotesUIDocument
Dim s As New notessession
Dim db As notesdatabase
Dim olddoc As notesdocument
Dim newdic As notesdocument
Set uidoc = ws.CurrentDocument
Set olddoc = uidoc.Document
olddoc.Status = "Aktenlager"
olddoc.Aktenort = "Aktenlager"
call uidoc.Reload
Call uidoc.Save
Set db = s.getdatabase ("S155LN03","Kredit\Aktenanforderung (Archiv).nsf")
Set newdoc = olddoc.copytodatabase(db)
Call uidoc.close
End Sub
-
Auf jeden Fall hast Du Option Declare nicht eingeschaltet, Donner:
Dim newdic As notesdocument
aber dann
Set newdoc = olddoc.copytodatabase(db)
dic = doc ? Eher nicht.
HTH,
Bernhard
-
Hast Recht Berhard und danke für die Hilfestellung Glombi - hoffe Dein Grillfleisch war gut ! ;)
Leider funzt das immer noch nicht, so wie ich das gern hätte.
Problem ist wohl das speichern zwischendurch. Wenn ich die Befehle rausnehme:
call uidoc.Reload
Call uidoc.Save
Dann wird anstandslos kopiert - aber halt ohne die neuen Änderungen.
Dubios !
???
-
Ja, war lecker :)
ich habe es getestet und es funktioniert - allerdings war ein anderer Fehler da: Die Zieldatenbank muss erst geöffnet werden:
Sub Click(Source As Button)
Dim ws As New notesuiworkspace
Dim uidoc As NotesUIDocument
Dim s As New notessession
Dim db As notesdatabase
Dim olddoc As notesdocument
Dim newdic As notesdocument
Set uidoc = ws.CurrentDocument
Set olddoc = uidoc.Document
olddoc.Status = "Aktenlager"
olddoc.Aktenort = "Aktenlager"
Call uidoc.Reload
Call uidoc.Save
Set db = New NotesDatabase("","")
Call db.Open("S155LN03","Kredit\Aktenanforderung (Archiv).nsf")
If db.IsOpen Then
Set newdoc = olddoc.copytodatabase(db)
End If
Call uidoc.close
End Sub
-
Yo - das funzt.
Herzlichen Dank !