When I tried to see whether a multivalue field contains a given content by variant with a button, error occured with “Object Variable not set”, but works well with the Debugger Lotusscript open, could anyone help me? Code is as below
…
Set uicomplete=doc.GetFirstItem(“areatrainingcompleted”)
…
If Not (uicomplete.contains(temps)) Then
uigap = uigap + “;” + temps
End If
Subject: Compare variant with document item does not work well
Hi,
This is not a method I’ve used (I normally walk through the values), but the code looks OK. The “Object Variable Not Set” could occur in one of two places. Either the “doc” object is not instantiated or the “uicomplete” item is not set. As a first step I would try and find out which is failing. You could do this by trapping the error and getting the line number i.e.
On Error Goto ProcessErrors
… code here …
Exit Sub
ProcessErrors:
MsgBox cstr(err) & " : " & error & ", at line " & cstr (erl)
exit sub
Or by adding a test for the notesitem i.e.
Set uicomplete=doc.GetFirstItem(“areatrainingcompleted”)
If Not (uiComplete is Nothing) then
If Not (uicomplete.contains(temps)) Then
uigap = uigap + “;” + temps
Else
MsgBox “The NotesItem was not found.”
End If
Hope this helps a bit. If it turns out that the “doc” is not instantiated, you will need to check the code that sets this.
Cheers
Alan