Different results for same script - different starting point

Hopefully I can explain this correctly. To track an instance of a trip leaving our facility I have created two documents. A parent and a child document.

The parent document contains the generic trip information, while the child document contains the detailed info about vehicle used, driver etc…

Basically I am using Lotus script to update both documents from the child document.

Now if I open the child document directly from a view all scripts work fine. The child document that the person is working on will update everything correctly and will refresh the uidoc from the back end document and show all changes just made.

Now if I access the child document indirectly by means of another small script from the parent document. And do the exact same steps as above, the uidoc will not refresh correctly from the back end document as above. All data is saved but you must exit the document and re-enter it for the newly changed data.

The small script in the parent document that opens the child document is just using a notesdocumentcollection and opening the first child (some instances may have a 2nd child but has no bearing on this) document. It closes the parent document and opens the child document.

Here is the small script that calls the child document from the parent document where things go astray

Sub Click(Source As Button)

Dim s As New NotesSession, db As NotesDatabase

Dim doc As NotesDocument, ndc As NotesDocumentCollection

Dim w As New NotesUIWorkspace, 	uidoc As NotesUIDocument



Set db = s.CurrentDatabase

Set uidoc = w.currentdocument

Set doc = uidoc.Document



Set ndc = doc.Responses

If(ndc.Count = 0) Then

	Messagebox "Please contact Administrator, No Trip Documents found" , , "Error:  No Documents Found"

	End

Elseif (ndc.Count = 1) Then

	Set tripdoc = ndc.GetFirstDocument

Elseif (ndc.Count = 2) Then

	Set tripdoc = ndc.GetlastDocument

End If



Call uidoc.close

Call w.EditDocument (True, tripdoc)		

End Sub

Here is the code that refreshes the uidoc. All data has already been saved to the backend document

	uidoc.EditMode = True

	Call uidoc.Reload

	Call uidoc.FieldSetText("SaveOptions","0")

	uidoc.EditMode = False

I am not using any global variables. I am sure there is something that I am not aware of with how notes handles what I am trying to do. But I have not a clue why this is happening.

Any ideas

Subject: Minor Correction and got it working but …

OK, a was wrong in explaining the document reload. It did update the uidoc correctly with the changes.

What was not being refreshed was the hide when formulas.

I was able to correct this easily by adding call uidoc.refresh to the scripts.

While this does fix the problem I am having I still have no idea why I was getting different results from different starting points.

If anyone has any idea why I was getting these odd results please let me know.

Since I have a workaround it is not a big deal, but still want to understand what was or wasnt going on.