I’ve got a form with a Time/Date field called Target. I’ve got the following script in the Querrysave event, but it’s not quite working. I’ve watched the variables and the source.document.Target field in the LotusScript debugger and it appears to be working, but the changed date is not in the record afterwards. The point of the whole thing is to push the target date out to Monday if it would fall on a weekend.
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim DateVar As NotesDateTime
Dim item As NotesItem
Dim wd As Integer
If source.IsNewDoc Then
Set item = source.document.GetFirstItem( "Target" )
wd% = Weekday(source.FieldGetText( "Target" ))
If wd = 1 Then
'Target is a Sunday
Set DateVar = item.DateTimeValue
Call DateVar.AdjustDay(1,True)
Set item.DateTimeValue = DateVar
Elseif wd = 7 Then
'Target is a Saturday
Set DateVar = item.DateTimeValue
Call DateVar.AdjustDay(2,True)
Set item.DateTimeValue = DateVar
End If
End If
End Sub