DialogBox cannot be used from inside DialogBox

Strange:On parent form there is RT field with doclink to response document.

I want to open response document in DialogBox.

QueryOpen event:

Dim workspace As New NotesUIWorkspace

Dim contactDoc As NotesDocument

Set contactDoc = Source.Document

Call workspace.DialogBox _

( contactDoc.form(0), True, False, False, False, False, False, “Contact”, contactDoc, True, False, True )

Continue = False

End Sub

First I get Notes Error Message:

“DialogBox cannot be used from inside DialogBox”

Then DialogBox is displayed normally and so on…

Q: Why is this happening?

Q: How to illuminate the message?

Thanks in advance

Subject: DialogBox cannot be used from inside DialogBox

If I understand you problem correctly, you have an event in your form that cancels opening and re-open it with the same form within a dialog box. Right?

If so, then your code would start an infinite loop since QueryOpen is also started when opening dialog box itself :

Open Form (STOP) → Open Dialog Box (STOP) → Open Dialog Box (STOP) → …

To avoid this, I would add a flag to document within your code :

QueryOpen event:

Dim workspace As New NotesUIWorkspace

Dim contactDoc As NotesDocument

Set contactDoc = Source.Document



If ContactDoc.IsDialog(0) = "1" Then

	'OK to open it so in DIalog box and remove flag

	Call ContactDoc.RemoveItem("IsDialog")

	Continue = True

Else

	'Is not in dialog box yet, so cancel opening and open it into dialog box

	ContactDoc.IsDialog = "1"

	Call workspace.DialogBox ( contactDoc.form(0), True, False, False, False, False, False, "Contact", contactDoc, True, False, True )

	Continue = False

End If

End Sub

Subject: RE: DialogBox cannot be used from inside DialogBox

Thanks, Block.This technique is new for me, but it works perfectly.

I have another question which could be easy for you to answer:

The whole scenario is like this:

Main form consists of sections.

ContactSection has RT field.

It this field I push all contacts and make doclink for each of them.

User opens doclink, modifies the contact, saves it and closes DialogBox.

At this point data in RT field represents the old version of the contact and needs to be refreshed.

Of course, I can plug the action to refresh data manually.

Q: Is there are way to do it automatically?

Thanks