This OnSubmit event updates the ProjectStatus field depending
on the difference between the current date and the date in the DueDate
field.Sub Onsubmit(Source As Notesuidocument, _
Continue As Variant)
Dim todayDT As NotesDateTime
Dim dueDT As NotesDateTime
Dim daysLeft As Long
Dim status As String
Call Source.Refresh
Set todayDT = New NotesDateTime("Today")
Set dueDT = New NotesDateTime _
(Source.FieldGetText("DueDate"))
daysLeft = dueDT.TimeDifference(todayDT) / 86400
Select Case daysLeft
Case 1, 2, 3
status = "Urgent"
Case 4, 5, 6
status = "Hurry up"
Case Else
status = "No worries"
End Select
Call Source.FieldSetText("ProjectStatus", status)
End Sub