Domino 9 und frühere Versionen > ND6: Entwicklung
Problem mit item.Contains
(1/1)
skywook:
Hallo,
habe ein Problem mit item.Contains folgende Fehlermeldung wird angezeigt: Object variable not set
Das Feld CALLERNUMBER ist eine Textliste.
Sub Initialize
On Error Goto ErrorHandler
Dim result As Integer
Dim anzahl As Integer
Dim s As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim item As NotesItem
Set db = s.CurrentDatabase
Set view = db.GetView( "($Inbox)" )
anzahl = 0
Set doc = view.GetFirstDocument
While Not(doc Is Nothing)
Set item = doc.GetFirstItem( "CALLERNUMBER" )
If item.Contains("Ok") Then ==== > hier kommt die Fehlermeldung
anzahl = anzahl + 1
End If
Set doc = view.GetNextDocument(doc)
Wend
......
hättet Ihr einen Tipp für mich.
Gruß Skywook
umi:
Prüf doch einfach vorher ob es überhaupt existiert.
Oder schau mal im Debugger das Notesdokument an, ob da überhaupt ein Item mit diesem Namen existiert.
--- Code: ---...
if not item is nothing then
if item.contains("Ok") then
...
end if
else
print "Item Callernumber nicht gefunden")
end if
...
--- Ende Code ---
Axel:
Überpruf mal mit dem Debugger, ob die Variable item korrekt gesetzt wird.
Evt. ist das Feld CALLERNUMBER nicht vorhanden.
Was mir in deinem Code fehlt ist eine vernüftige Fehlerbehandlung. Auf diesen Punkt wurde hier im Forum schon sehr oft hingewiesen. Kein Code ohne Fehlerbehandlung.
Axel
Navigation
[0] Themen-Index
Zur normalen Ansicht wechseln