次の OnSubmit イベントは、現在の日付と [DueDate] フィールドの日付の差異に基づいて、[ProjectStatus] フィールドを更新します。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