I have an agent that runs on selected documents the only field not updating is the date field SMRefUsedDate.
Can any one assist me in finding out what I am not doing - Thank You so much for all your help & assistance
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim collection As NotesDocumentCollection
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
Dim i As Integer
Dim ReferCount As Double
Dim MaxCount As Double
Dim CoName As String
For i = 1 To collection.Count
Set doc = collection.GetNthDocument(i)
'obtian the max count
MaxCount = Cdbl(doc.GetItemValue("SMCoNameCount")(0))
' if max count >= Current Count then no more references with this company
ReferCount = Cdbl(doc.GetItemValue("SMRefCounter")(0))
If ReferCount >= MaxCount Then
CoName = doc.GetItemValue("Company2")(0)
Msgbox("This Company, "+ CoName + ", cannot be used as reference :" + doc.GetItemValue("Company2")(0))
Else
Call doc.ReplaceItemValue("SMRefCounter", ReferCount + 1)
Dim SMRefUsedDate As NotesDateTime
Call SMRefUsedDate.setnow
Call doc.ReplaceItemValue("SMRefUsedFor","")
Call doc.ReplaceItemValue("SMRefUBy",session.username)
Call doc.Save(True,True)
End If
Next