Subject: RE: Edit multiple docs at once
aaah, so you want to continue to edit the one doc and you want that one doc to keep another one (or two) current.
If true, you need a method to know how to get the other docs repeatedly and dependably… one easy way could be to make the other doc(s) response docs. So as you edit the parent you can very easily get it’s child(ren) and update them too.
One concern… if you are continuing to update another doc programmically, you don’t want to do that if someone is editing the other doc at the same time (save conflicts)… I suggest you not allow editing in the other doc(s)… you could have an edit button though… it opens the parent ‘$Ref’.
To stop someone from editing it, make sure you don’t have ‘Automatically enable Edit Mode’ ON and in the postopen, put this snippet:
Sub Postopen(Source As Notesuidocument)
'this prevents edit mode on open
Dim s As New NotesSession
Dim db As NotesDatabase
Set db = s.currentdatabase
Dim uidoc As Notesuidocument
Dim w As New NotesUIWorkspace
Set uidoc = w.currentdocument
If Not uidoc.IsNewDoc Then
'this prevents edit mode on open
If source.EditMode=True Then
source.EditMode = False
End If
End If
End Sub
In the querymodechange put this snippet:
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
Messagebox(“Document available for browsing only.” )
Continue = False
Exit Sub
End Sub
When you initially create the other doc(s) in the background you can make them response docs using the MakeResponse Method.
Later when you want to update them, you can easily get a handle to them (documentCollection) with doc.getResponses();
Then interate through them with:
'Iterate Through Collection and either use an if clause or select case to handle each appropriately
Set responsedoc = collection.GetFirstDocument
While Not (responsedoc Is Nothing)
if responsedoc.GetItemValue( “Form” )(0) = “Order” Then
'do what you want within the order doc
End if
Set responsedoc = collection.GetNextDocument(responsedoc)
Wend
That work?