Return to the Lotus Tips
Agent to replace Date field values by Max Prozy
From: SEARCHDOMINO.COM | Developer Tip December 16, 2002 If you try to use the usual procedure, (doc.ReplaceItevValue) for changing values of Date/time fields, it will fail, because this procedure changes the field type to text. Here is code that solves this problem: Suppose you have a field "date" which stores some date values you are about to change... Code: Sub Initialize Dim w As New NotesUIWorkspace Dim dc As NotesDocumentCollection Dim doc As NotesDocument Dim Item As NotesItem Dim nDate As NotesDateTime Set dc=w.CurrentView.Documents If dc.Count>0 Then d=Format(Cdat(Inputbox ("Please input a new date value", "New date")),"dd.mm.yyyy") Set nDate=New NotesDateTime(d) Set doc=dc.GetFirstDocument While Not (doc Is Nothing) Set item=doc.GetFirstItem("date") Set item.DateTimeValue=nDate Call doc.Save(True,True) Set doc=dc.GetNextDocument(doc) Wend End If End Sub
[report a broken link by clicking here]