Link to home
Start Free TrialLog in
Avatar of jforget1
jforget1

asked on

Code freezing system

Have the code below in an agent, this agent is triggered by a button, the agent is set for selected docs and is triggered while in a particular record. It is sending the tracer needed, but for some reason it is freezing up my system. Is there something I have wrong in here which would freeze everything up like that.

Joe


Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim uidoc As NotesUIDocument
      Dim doc As NotesDocument
      Dim emaildoc As NotesDocument
      Dim Item As NotesItem
      Dim twoliner As String
      Dim rtitem As NotesRichTextItem
      Set db = session.CurrentDatabase
      Set col = db.UnprocessedDocuments
      Set doc = col.GetFirstDocument
      On Error Resume Next
      While Not doc Is Nothing
            If doc.input_flag(0)<>"done" Then
                  Set emaildoc = db.CreateDocument
                  emaildoc.form = "bb_input" 'Form name of Letter
                  emaildoc.SendTo = doc.EE_Name(0)
                  emaildoc.Principal = "Field Technology"
                  emaildoc.Subject ="Order for " +  doc.name_adjusted (0)+ " has been forwarded for processing."
                  Call emaildoc.Send(True)
                  doc.input_flag = "done"    'field name for flag
                  doc.status = "Order Input"
                  Call doc.Save(True,True)
            End If
      Wend
End Sub
Avatar of SysExpert
SysExpert
Flag of Israel image

your loop
While Not doc Is Nothing is always going run.

You need to exit somewhere !

I hope this helps !
ASKER CERTIFIED SOLUTION
Avatar of SysExpert
SysExpert
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jforget1
jforget1

ASKER

As always right on the money. Thanks for the help.