Hi help,
I have the below script under the “on change” parameter of a variable in a form. What is the code to set my date field “DesignComplete” to today’s date?
Thank you very much, Paul
Sub Onchange(Source As Field)
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Call uidoc.FieldSetText("ModifiedBy",session.CommonUserName)
Call uidoc.FieldSetText("ModifiedOn", Cstr(Now))
End Sub
Subject: try Today()
Add this to your script:
Call uidoc.FieldSetText(“DesignComplete”, Cstr(Today))
Even though it is a date time field, and you are putting in text, you are doing it in the UI and internal process should convert it–I think.
-Kyle Huang
Subject: Thanks
Kyle, that was so simple!
Thanks so much, Paul
Subject: another option is just “today” since you are in the front end
The string “today” will get evaluated to today’s date when the document is saved or refreshed (F9). That won’t work in the back end classes, ie, NotesDocument.
Howard