Change main form field.
Posted on 2003-11-09
The "main" form has the fields "Name" and "LastName" (computes).
On changing the field "Name" value (eg. the name is not entered corectly), on Qsave I nedd to search all documents with the field "Name" in db and change its value (some od documents are responses to "main" form but some are not).
I tried with view "AllDocuments" and next script in Qsave:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim entry As NotesViewEntry
Dim vc As NotesViewEntryCollection
Name = Source.FieldGetText("LastName")
Set db = session.CurrentDatabase
Set view = db.GetView("AllDocuments")
Set vc = view.GetAllEntriesByKey("Name")
Set entry = vc.GetFirstEntry()
While Not ( entry Is Nothing)
Set doc = entry.Document
Call doc.ReplaceItemValue( "Name", Name)
Call doc.Save (True, False)
Set entry = vc.GetNextEntry(entry)
-but no result. What is the proper way to solve this task. Thanks.