Hallo zusammen,
folgende Function liefert mir ohne Debugger nichts zurück, so dass mir bei Verwendung ein "Object Variable not set" um die Ohren gehauen wird. Jedoch lasse ich es mit Debugger laufen funktioniert die Funktion ohne Tadel... Das verstehe ich nicht ganz, warum sich die Funktion mit und ohne Debugger unterschiedlich verhält...
Function getLocationDocument(locationName As String) As NotesDocument
Dim session As NotesSession
Dim names As NotesDatabase
Dim auview As NotesView
Dim au As NotesDocument
Dim aucoll As NotesDocumentCollection
Const NAME_VIEW_LOCATIONS$ = "Locations"
Set session = New NotesSession
Forall db In session.AddressBooks
If db.Isprivateaddressbook Then
Set names = db
If Not names.IsOpen Then
Call names.Open("","")
End If
Exit Forall
End If
End Forall
Set auview = names.GetView(NAME_VIEW_LOCATIONS$)
Set aucoll = auview.GetAllDocumentsByKey(locationName,True)
Set au = aucoll.GetFirstDocument
Set getLocationDocument = au
End Function
Forall db In session.AddressBooks
If db.Isprivateaddressbook Then
Set names = db
If Not names.IsOpen Then
Call names.Open("","")
End If
Exit Forall
End If
End Forall
Prüfe doch mal mit if db is nothing ob überhaupt ein DB Objekt gesetzt ist.