Notes Dates and .SetNow

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

Subject: Notes Dates and .SetNow

Sue,

You are setting the value of a variable called “SMRefUsedDate” rather than the field. NotesDateTime is a data type rather than reference to a date/time field on a Form.

To fix, replace

Dim SMRefUsedDate As NotesDateTime

Call SMRefUsedDate.setnow

with

call doc.ReplaceItemValue(“SMRefUsedDate”, Now) or doc.SMRefUsedDate=Now (this is the “shortened” version of doc.ReplaceItemValue)

Hope this is OK

Mike

Subject: RE: Notes Dates and .SetNow

Thank you so much - I knew I was not looking at something right.