Automaticall refreshing a view

I am having a problem with trying to auto refresh a view. I want users to click a button on an open response document. This should update a value on the parent document and delete the document and take it of the view instead of just marking it for deletion and then prompting the user whether he/she wants to delete. My script is shown below and I am not sure what I am doing wrong.Sub Click(Source As Button)

Dim session As New NotesSession

Dim workspace As New NotesUIWorkspace		'

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document

Dim parentID As String

Dim var1 As Variant

Dim var2 As Integer

parentID = doc.ParentDocumentUNID

Dim db As NotesDatabase

Dim pdoc As NotesDocument

Dim item As Variant

Set db = session.CurrentDatabase

Set pdoc = db.GetDocumentByUNID(parentID)

var1 = pdoc.num(0)

var2 = var1 - 1

Call pdoc.ReplaceItemValue("num",var2)

Call pdoc.save(True,True)	

Call uidoc.DeleteDocument

End Sub

Subject: Automaticall refreshing a view

I think you need to delete the background document ie doc in your code.Then use the backend view.

Uiview.view.

and refresh that

view.refresh

and maybe also refresh the fontend view via the property in uiworkspace

uiworkspace.viewrefresh