You might want to add error trapping in the code. Here is an example
'The following line says to jump to the label called ErrorHandler if there is an error.
On Error Goto ErrorHandler
Dim s As New NotesSession
Dim thisAgent As NotesAgent
'This is used to obtain the name of the agent currently running.
Set thisAgent = s.CurrentAgent
'Your code goes here
'The Done label is there so you can reference it in your ErrorHandler.
'The Exit Sub jumps past the ErrorHanlder if the code above successfully completes.
'The Select statement enables you to handle test for different errors. For example,
'when Err is 53, it indicates "File not found." With some errors, you might choose to
'skip to the next line of code, rather than exiting the entire subroutine.
'For more details, open the "On Error statement" in the Designer help database Index.
Select Case Err
'The next line will document an error, and will include the error number, the agent name,
'the line throwing the error, and the error description.
'The agent name is helpful if this is a web triggered or scheduled agent.
Msgbox "Error " & Cstr(Err) & " in " & thisAgent.Name & " on line " & Cstr(Erl) & ": " & Error
Persnickety LotusScript Error (Stacy Elmwood 18.Dec.17)
Feedback response number WEBBAU74BU created by Barry Shapiro on 12/18/2017
. . no problem. (Mike Woolsey 18.Dec.17)
. . You want to test if item is empty (Carl Tyler 18.Dec.17)
. . . . Error trap (Barry Shapiro 18.Dec.17)
. . . . Empty?? (Stacy Elmwood 20.Dec.17)
. . . . . . Inspect using debugger (Martha Geppert 20.Dec.17)
. . . . . . . . It's there alright, but not seen? (Stacy Elmwood 21.Dec.17)
. . . . . . . . . . I wonder if it being summary protec... (Carl Tyler 21.Dec.17)
. . . . . . . . . . . . Access Level = Manager (Stacy Elmwood 21.Dec.17)
. . . . . . . . . . Look further at the field / item (Martha Geppert 22.Dec.17)