Getting Hold of BackEnd And showing in the UI Crashes

The code is pretty straight forward , but I cannot understand why the client keeps crashing on me. I am grabbing a doc in the backend and want to present it to the user on the front end.

Set pdoc = db.GetDocumentByUNID(doc.PrimaryUNID(0))

Call ws.SetTargetFrame(“BottomFrame1”)

If Pdoc Is Nothing Then

	Messagebox "Could Not Locate the Primary Account for the Select Call Plan Item,"	,, "Not Found"	 

	Exit Sub 

Else

	Call ws.editDocument(False, pdoc, False)

End If

And the error code returned is -28363.

And then client crashes. I reproduced it every time and even my testers clients shutdown.

Help…