The following is the sample codes I did. I want to create a button in a form (doc), and this button suppose to change a field value (MyField) in all response forms (rpdoc) that match a specific key (“ABC”). But when I run this codes, the system will change the field (MyField) in ALL response forms regardless whether it match the key (“ABC”) or not. Can anyone tell me where goes wrong with this codes?
Dim view As NotesView
Set view = db.GetView(“MyView”)
Dim ABC As String
ABC = uidoc.FieldGetText(“MyKey”)
Dim entry As NotesViewEntry
Set entry = view.GetEntryByKey(ABC, True)
Dim rpdoc As NotesDocument
Set rpdoc = entry.Document
Set nav = view.CreateViewNav()
Set entry = nav.GetFirstDocument
While Not(entry Is Nothing)
Set rpdoc = entry.Document
If doc.GetItemValue(“MyField”)(0) <> “” Then
rpdoc.MyField = doc.MyField
End If
Call rpdoc.Save(True, True)
Set entry = nav.GetNextDocument(entry)
Wend
Thanks.