Not allowing to delete a PO with Prepayment scripting...

I have a script that launches if a user attempts to delete a Po with a prepayment.  Here is my script.  It works when the user click on Delete button on an existing PO with prepayment.  The problem is however, it removes lines of the PO.  I have this script to fire at PO Table - Pre Delete Can anyone help with this?

oSession = 0

Prepay = 0

retVal = oBusObj.GetValue("PrepaidAmt", PrePay)

if Prepay <> 0 then

oScript.SetError("Cannot delete order")

retVal = oSession.AsObject(oSession.UI).MessageBox("The prepayment amout on this order is:$ " & Prepay)

retVal = oSession.AsObject(oSession.UI).MessageBox("Cannot delete PO with Prepayment!")

End If