parent doesn't know response, but response knows its parent

Form A and his response form B.
We create a document A' with form A. On this form A there is a button to create a response document with form B, this response document we call B. the code for this action is in brief
        where ws is the current workspace
In a view with selection @All I see them both as main and response ( OK so far).
Then later I trigger another action button on Form(document) A. In this action I want to do things with the response form. The LS - code looks like this :
     Dim ws As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Dim newdoc As NotesUIDocument
     Dim responses As Notesdocumentcollection    
     Dim numberresponses As Integer
     Set uidoc = ws.currentdocument
     Set responses = uidoc.document.responses
     numberresponses = responses.count
     Messagebox("number resp."+Cstr(numberresponses)

The messagebox returns me 0 for the number of responses to document A But I know there has to be one.
Furthermore the $Ref field of the responsedocument B gives me the ID of maindocument A.
So the response knows its parent, but the parent doesn't know its response.
What can I do. I already thied the makeresponse method of NotesDocument to explicite link main and response but still the same problem.
Who is Participating?
Looks like everything is ok, except for missing bracket in msgbox stmt.

Open the document from the view which has response hierarchy and try to run this action from the opened doc , just a try !

What happens if you split this one line

Set responses = uidoc.document.responses


Dim doc As NotesDocument
Set doc = uidoc.document
Set responses = doc.responses
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Hello ruddi,

I checked your code, and it works fine on my computer.

So, please check on your side this things:
1.) Is your Form B realy a form of type "Response"?
2.) Wath do you meen with "later" in your description: do you close and open the parent document? Or even worser: meen you later in the same code where you produced the B doc? If so, then use delete and reopen of parent documents Object in the LotusScript code.

ruddiAuthor Commented:
to hermanth  : the result stays unfortunately the same.
to crak : the result stays unfortunately the same.
to zvonko 1) B form is a response doc
          2)later means really later. After the maindoc has been closed and saved and so.  
Sorry, but in my scenario did the code worked without problems. It worked in a button and in an action. And without closing the main parent document I got every time the correct nomber of descendants.
So it has to deal with something that is different in your coding...
Have you checked for this "Don't support specialized response hierarchy"?
After unchecking it you have to recompact with -H option.
Hey ruddi,

forgotten my points? <|;-)
ruddiAuthor Commented:
Sorry zvonko but I only have read your reply until today.
But it works with the don't support specialized response hierarchy and the compacting.
So your certainly earned your points
ruddiAuthor Commented:
the workaround stated in this document on the works. It is however necessary to close and restart your lotus notes server for this solution to work.
Thank's for the points and for the feeback <|;-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.