I'm assuming that there is some unique field that the "parent" and the "children" documents have in common; otherwise your situation is hopeless. Let's suppose that a parent's AccountID field is the same as the ParentAccountID field in the children.
You need a view of the children documents sorted by ParentAccountID. When you need to update the children documents, you could then use code such as the following in the Postsave event of the parent document:
...StampAll is nice if there is just one field you need to update. If there is more than one you should use GetFirstDocument, GetNextDocument to loop through the children documents and make the appropriate updates.
Set parentDoc = Source.Document
Set view = db.GetView("ChildrenByAccountID")
Set col = view.GetAllDocumentsByKey(parentDoc.AccountID(0))
If col.Count > 0 then
' there are some children documents. Update the AccountName field in these documents.
col.StampAll "AccountName", doc.AccountName
Note, however, that there are potential problems with doing this kind of update, no matter how you write the code. In a replicated environment like Notes, there's no way to be certain that the children documents you have in the current replica are all the children documents there are -- there may be some created in another replica that haven't arrived here yet. Plus, since other users -- or the current user! -- may be editing some of the children documents at the time your script runs, there's a chance of save conflicts.
You might consider not storing duplicate copies of fields at all -- instead, use @DbLookup to display the values in "computed for display" fields in the child document. Or if you must have the copies -- for example, because the values have to appear in views -- you might have to add overnight agents to make sure any recently modified documents contain consistent information.
This was first published in May 2003