我正在尝试在Lotus Notes中为表单编写日志记录系统,但是我不知道如何追加有关在日志中更改的字段的信息领域。有3个字段使用Log_Date(日期),Log_User和Log_Actions(文本,允许多个值)。在Lotus Notes中使用多值字段
我想如果我将逗号添加到日志字段,它将在显示表单时创建一个新行,但我仍然在案例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
如果他将其作为Log_Actions(0)来处理,并且不会更改代码中的其他任何内容,那么他将不会将其视为多值项目。他只会用逗号分隔的列表创建单个值。如果他在Notes UI中打开文档,编辑并保存该文档,可能会导致出现奇怪的行为。也就是说,如果该字段设置为多值并带逗号分隔符显示,则保存操作将把它分解为多个值,然后下一次他的代码运行时,它将再次追加到第一个值。 – 2012-01-30 22:12:54
绝对如此,我只处理类型不匹配错误。 – 2012-01-31 07:33:56