Notes Error - Specified command not available from the workspace

Could someone please tell me why I’m getting this error. I get the error when I use the EditDocument method in the code below.

Sub Click(Source As Button)

Dim s As New NotesSession

Dim db As NotesDatabase

Dim ws As New NotesUIWorkspace

Dim uid As NotesUIDocument

Dim doc As NotesDocument

Dim lookupdoc As NotesDocument	

Dim rti As NotesRichTextItem

Dim dc As NotesDocumentCollection



Set db=s.CurrentDatabase

Set uid=ws.CurrentDocument

Set doc=uid.Document	



Dim retval As Variant



retval=doc.GetItemValue("RequiredReading3")



If Not retval(0)="" Then

	Set rti=doc.GetFirstItem("RequiredReading3")

	Call rti.remove

	Call doc.Save(True,False)

End If	



Set rti=New NotesRichTextItem(doc,"ReguiredReading3")



Set dc=ws.PickListCollection(3,True,DB.Server,db.FilePath,"By Topic","Select Documents to Link","Please select one or more documents.")

doc.Form="Reading"	



Dim i As Integer	

If Not dc.Count=0 Then	

	For i=1 To dc.Count

		Set lookupdoc=dc.GetNthDocument(i)

		If Not(lookupdoc Is Nothing) Then

			Call rti.AppendDocLink(lookupdoc,lookupdoc.subject(0))

			Call rti.AddTab(1)

			Call rti.AppendText(lookupdoc.subject(0))

			Call rti.AddNewline(1)		

			Call uid.Close

			Call rti.Update		

			Set uid=ws.EditDocument(True,doc,,,True)

		End If

	Next

End If

End Sub