I am having an unusual problem with this agent it runs great but every once and a while it drops out of the loop even though there are still more documents in the view. In the debugger it get to loop and just quits with the count…. Any idea……. I have found documents that it failed on and removed the doc and restarted the agent and it runs then fails again. Also how does the agent decide what doc to run on first?here is the code
Sub Initialize
Set s = New Notessession
Dim db As Notesdatabase
Set db = s.CurrentDatabase
Dim View As NotesView
Dim Doc As notesdocument
Dim eval1 As Variant
Dim eval2 As Variant
Dim eval3 As Variant
Dim eval4 As Variant
Dim eval5 As Variant
Dim count As Integer
Dim countOwner As Integer
Dim countAdmin As Integer
Dim countEquipOwner As Integer
Dim countDocAuthor As Integer
Set view = db.GETVIEW("1. Calibration \ A1. By OwnerTemp")
Set doc = view.getfirstdocument
'begin counting documents and changes ***********
count = 0
countOwner = 0
countAdmin = 0
countEquipOwner = 0
countDocAutor = 0
'set value for new Domain***********
newValue = "/DPC"
Do Until doc Is Nothing
'get values of fields ************
Owner = doc.Owner(0)
Owner_1= doc.Owner_1(0)
Admin = doc.Admin(0)
Admin_1 = doc.Admin_1(0)
EquipOwner = doc.EquipOwner(0)
DocAuthor = doc.DocAuthor(0)
DocAuthors = doc.DocAuthors(0)
DocAuthors2 = doc.DocAuthors_1(0)
'get just for information
Description = doc.Description(0)
'evaluate and make entry common********
eval1 = Evaluate("@Name([CN]; Owner) ", doc)
eval2 = Evaluate("@Name([CN]; Admin) ", doc)
eval3 = Evaluate("@Name([CN]; EquipOwner) ", doc)
eval4 = Evaluate("@Name([CN]; DocAuthor) ", doc)
eval5 = Evaluate("@Name([CN]; DocAuthors) ", doc)
eval6 = Evaluate("@Name([CN]; Owner) ", doc)
'*****Set the Domain Strings*****
Dim domSubString1 As String
Dim domSubString2 As String
Dim domSubString3 As String
Dim domSubString4 As String
Dim domSubString5 As String
Dim domSubString6 As String
'*****Set the Strings*****
Dim subString1 As String
Dim subString2 As String
Dim subString3 As String
Dim subString4 As String
Dim subString5 As String
Dim subString6 As String
'*****Test Owner and change********
domSubString1$ = Right(Owner,10 )
If Lcase$(domSubString1$) = "clovertech" Then
subString1$ = eval1(0)
OwnerTemp = subString1$ + newValue
doc.Owner = OwnerTemp
Print doc.Owner(0)
countOwner = countOwner +1
End If
'******Test Admin and change******
subString2$ = Left$(Admin,10 )
domSubString2$ = Right(Admin,10 )
If Lcase$(domSubString2$) = ("clovertech" ) Then
subString2$ = eval2(0)
AdminTemp = subString2$ + newValue
doc.Admin = AdminTemp
Print doc.Admin(0)
countAdmin = countAdmin +1
End If
'*******Test EquipOwnerand change******
domSubString3$ = Right(EquipOwner,10 )
If Lcase$(domSubString3$) = "clovertech" Then
subString3$ = eval3(0)
EquipOwnerTemp = subString3$ + newValue
doc.EquipOwner = EquipOwnerTemp
Print doc.EquipOwner(0)
countEquipOwner = countEquipOwner +1
End If
count = count +1
Call doc.Save(True,True)
Set doc = view.getNextDocument(doc)
Loop
Messagebox (Count)
End Sub