Hallo zusammen,
wie kann ich prüfen, ob es ein Dokument mit einer bestimmten Unid in einer Datenbank überhaupt gibt, ohne einen Fehler zu produzieren wenn es das Dokument nicht gibt? Ich suche sowas wie
If db.HasDocument(unid) Then
Set vaDoc = db.GetDocumentByUnid(unid)
Else
Messagebox "Dokument nicht gefunden"
End If
Ich mache das mit einer eigenen Function, die ich anstelle von db.GetDocumentByUnid verwende
Function MyGetDocumentByUnid (db As NotesDatabase, unid As String) As NotesDocument
On Error Goto Fehler
Set MyGetDocumentByUnid = db.GetDocumentByUnid (unid)
Exit Function
Fehler:
Set MyGetDocumentByUnid = Nothing
Exit Function
End Function
Wird dann so verwendet
Set doc = MyGetDocumentByUnid (db, unid)
If Not doc Is Nothing Then
...
End If