Domino 9 und frühere Versionen > ND7: Entwicklung
UNID
ch:
Bei Set bringt er leider immernoch den error: "invalid id"
REM %INCLUDE "lsxbeerr.lss"
Sub Initialize
REM Archivierung...
Dim session As New NotesSession
Dim db As NotesDatabase
Dim arcdb As New NotesDatabase("","chug_kop.nsf")
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim doc2 As NotesDocument
Dim doc3 As NotesDocument
Dim wert As Variant
Dim wert1 As Variant
Dim wert2 As Variant
Dim wert3 As Variant
Dim wert4 As Variant
Set db = session.CurrentDatabase
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
While Not doc Is Nothing
wert4 = doc.GetItemValue("status")
If wert4(0) = "offen" Then
REM offen und noch keine UNID vorhanden..
REM On Error lsERR_NOTES_ERROR Goto label1
On Error Goto label1
Set doc3 = arcdb.getDocumentByUNID(doc.zuDokiD(0))
label1:
If Err <> 0 Then
wert = doc.GetItemValue("Titel")
wert1 = doc.GetItemValue("Name")
wert2 = doc.GetItemValue("Thema")
wert3 = doc.GetItemValue("Telefonnummer")
Set doc2 = New NotesDocument( arcdb )
doc2.Form = "Task"
doc2.TaskType = "1"
doc2.Categories = "offene Telefonate"
doc2.TaskType = "1"
doc2.tmpOwnerHW = "1"
doc2.tmpNoActionBar = "1"
doc2.NoticeType = ""
doc2.~_ViewIcon = 8
doc2.Subject = wert(0) & " - " & wert1(0) & " - " & wert3(0) & " - " & wert2(0)
Call doc2.ComputeWithForm(False, False)
Call doc2.Save( True, False )
If doc2.Save( True,False ) Then Messagebox "Document " & doc.UniversalID & " successfully saved"
doc.zuDokiD = doc2.UniversalID
Call doc.Save( True, False )
Err=0
Else
Goto schleife
End If
Schleife:
End If
Set doc = dc.GetNextDocument( doc )
Wend
End Sub
koehlerbv:
Ein richtiges ErrorHandling hast Du ja noch gar nicht, Claudia. Schau Dir hierzu bitte mal wegen der Grundlagen folgenden Thread aus dem Forum an: Best Practices: Error Handling in Lotus Script.
In Deinem Fall reicht - wenn Du ein allgemeines ErrorHandling verwendest und nur kurzzeitig dieses umsetzt - folgendes:
Du setzt das ErrorHandling vor dem Holen des Docs via UNID auf
On Error Resume Next
Damit - und das ist wichtig - wird der Fehlerstatus wieder aufgehoben (was Du derzeit überhaupt nicht machst - daher bekommst Du ja auch weiter die Meldung).
Nun fragst Du ab, ob das instantiierte Doc überhaupt existiert - und stellst vor allem das allgemeine ErrorHandling wieder her.
HTH,
Bernhard
ch:
Danke hat funktioniert.
lg claudia
koehlerbv:
Wie hast Du es in Deinem speziellen Fall jetzt gelöst? Sicherlich stolpert auch später nochmal ein dankbarer Entwickler über diesen Thread ...
Bernhard
Navigation
[0] Themen-Index
[*] Vorherige Sete
Zur normalen Ansicht wechseln