我正在尝试为 Lotus Notes 中的表单编写日志记录系统,但我不确定如何附加有关在日志字段中更改的字段的信息。我使用了 3 个字段 Log_Date(日期)、Log_User 和 Log_Actions(文本,允许多个值)。
我想如果我在日志字段中添加逗号,它将在显示表单时创建一个新行,但我仍然在案例 2 行上遇到类型不匹配。
如何将新值附加到日志字段?
Sub Querysave(Source As Notesuidocument, Continue As Variant)
' Compare the values in the form after it is saved with its original values when the document is not a new document.
Dim doc As NotesDocument
Set doc = Source.Document
Dim session As New NotesSession
Dim user As String
user = session.CommonUserName
If newDoc Then
doc.Log_Date = Now()
doc.Log_User = user
doc.Log_Actions = "New document created."
Else
' Load fields value to the array
lastValues(0) = doc.QCR_No(0)
lastValues(1) = doc.QCR_Mobile_Item_No(0)
lastValues(2) = doc.QCR_Qty(0)
' Compared each value in the array to see if there is any difference
Dim i As Integer
For i = 0 To 2
If lastValues(i) <> originalValues(i) Then
Select Case i
Case 2 : doc.Log_Actions = doc.Log_Actions & "," & "Field QCR_Qty is changed"
End Select
End If
Next
End If
End Sub