Just to let you know about the following problem which has no solution…i’m pretty sure…When you build a parent-response document structure in a notes database, sometimes it may happen you want to create a response document starting from an open parent document…then the user works on the response document and if he wants to attach a document in it you have to code the script to close and re-open the response to show the attach in the proper field (and not at the bottom of the document as it always happen). you may think it would be good to refresh the parent document with some values saved in the response and you may think to refresh the parent in the queryclose event of the response…but when you close and re-open the response for the attach routine…notes switch the user always to the parent window 'cause it launch the close event of the response at the end of the script you did to attach the file…It’s not a great problem but it is not so nice to put a button in the parent document and force the user to use it to refresh computed fields with response values…I think there’s no solution…let me know if you disagree…
It sounds like the problem is in the close event of the response doc. Since you are programmatically closing the UIDoc, the close event should take that into consideration. You may want to set a temporary global variable to avoid some of the code in the close event.
Thanks for your post Doug…i put some of my code to let you know more about the situation.In the response document i created an Action HotSpot with the code to create and attach a word file. This script ends with the following lines:
In the queyclose event of the response document i also have these lines to refresh parent document:
If source.EditMode And currdoc.switch(0) <> "0" Then
parentUnid$ = currdoc.ParentDocumentUNID
Set docpadre=db.GetDocumentByUNID(parentUnid$)
If Not docpadre Is Nothing Then
Set uidoc=uiws.EditDocument(True, docpadre,,,, False)
Call uidoc.Refresh
Call uidoc.Reload
End If
End If
As you probably already noticed…i use field “switch” to avoid this piece of code from being executed when user creates word attach.
The problem is that it looks as if it execute the uidoc.close line the end of the attach script… after all in other words, but at that moment field switch has been already set to “1” and in the queryclose it opens parent (or set focus to it if it is already open) and user find himself with the focus on parent window and not on response one.