这个问题与我原来的问题有关
我正在尝试遵循肯的建议。所以我只想看看如果原始值和上次保存的值相同,我是否至少可以弹出一个消息框。这是我设置的东西。
Global declaration
Dim originalValues(2) As Variant
Dim lastValues(2) As Variant
然后在查询打开:
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
' Current document
Dim doc As NotesDocument
Set doc = Source.Document
' Array containing original value
originalValues(0) = doc.QCR_No
originalValues(1) = doc.QCR_Mobile_Item_No
originalValues(2) = doc.QCR_Qty
End Sub
保存后
Sub Postsave(Source As Notesuidocument)
' Current document
Dim doc As NotesDocument
Set doc = Source.Document
' Load fields value to the array
lastValues(0) = doc.QCR_No
lastValues(1) = doc.QCR_Mobile_Item_No
lastValues(2) = doc.QCR_Qty
' 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
Messagebox "Same", MB_OK
End If
Next
End Sub
现在说到这条线
如果 lastValues(i) = originalValues(i) 那么
我收到一个错误“类型不匹配”,我不明白为什么。我调试了代码,数组中的值都是一样的。该数组也具有 Variant 数据类型。我在这里做错了什么?