How to open an existing document using @Dialogbox

Hi, I have problem open existing document selected from view using @Dialogbox. Is it possible to do so? I have tried to put in the @Dialogbox formula under the form formula or Target Frame (Single Click) / (Double Click), it does not work at all, it just open a new form but not the selected document.

Please advice. Thank you.

Subject: How to open an existing document using @Dialogbox

sample example…

which document is selected from view based on key

Sub Click(Source As Button)

Dim ws As New NotesUIWorkspace

Dim ui As NotesUIDocument 

Dim ss As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim key As String 

Dim doc As NotesDocument

Set db = ss.CurrentDatabase

Set view = db.GetView("BD")

Set ui=ws.CurrentDocument 

key =ui.FieldGetText ("txt_cno")

If key="" Then

	Msgbox "Enter Your Complaint Number"

	continue=False

	Exit Sub

End If

If Len(key)<17 Then

	Msgbox "Complaint Number is in Correct"

	continue=False

	Exit Sub

End If

Set doc = view.GetDocumentByKey(key)

If Not (doc Is Nothing) Then

	Messagebox  doc.GetItemValue ("txt_status")(0)

	Msgbox doc.UniversalID 

	Call ws.EditDocument(True,doc)

	Call ws.SetTargetFrame ("2")

Else

	Messagebox  "Document Not Found"

End If      

End Sub