Agent to Change Frame Content runs but fails to change

Wow have I been asking alot of questions, thanks for all the help lately folks.

The issue I have run into today is that when I call an agent from a button in Lotusscript the agent runs but fails to change the content of the frame. I can do the same thing with formula but there are some calls to classes that I am making in the button which I can’t do in formula, and I can’t put the calls in querysave as they are different based on roles.

The button is coded as follows:

Dim workspace As New NotesUIWorkspace

Dim session As New NotesSession	

Dim db As notesdatabase

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim agent As NotesAgent

Dim tmpSaveOptions As Variant



Set db = session.currentdatabase

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document



/..

…/

Call uidoc.Save



tmpSaveOptions = uidoc.FieldGetText("SaveOptions")



If tmpSaveOptions = "1" Then

	Messagebox "Document Saved",,"Saved"		

	Set agent = db.GetAgent("toMainNavFrame")

	If agent.Run(doc.NoteID) = 0 Then

		Messagebox "Agent ran",, "Success"

	Else

		Messagebox "Agent did not run",, "Failure"

	End If

End If

The agent is coded as follows:

Dim workspace As New NotesUIWorkspace

Call workspace.SetTargetFrame("MainNav")

Call workspace.ComposeDocument("","","About")	

Am I trying to do something that isn’t allowed?