Setting Multiple views in a frame programatically

Hi,

I have got a frameset with 2 frames left & right. The left frame calls a form with a radio button field . The field has 2 choices A & B. By default the right frame calls a view x. I want it to change to view y, when I choose the value of the field as B. I have written the code:

Sub Onchange(Source As Field)

Dim db As NotesDatabase

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument 

Dim uidb As NotesUIDatabase



Set db = session.CurrentDatabase

Set uidoc = ws.CurrentDocument

Set uidb = ws.CurrentDatabase

If uidoc.FieldGetText ("nav") = "B" Then

	Call ws.SetTargetFrame("Right") 

	Call uidb.OpenView ("Y" )

	Call ws.ViewRefresh

End If

End Sub

It does not work. Pls help.