
    Ronald Thacker HARGESHEIMER, Appellant, v. The STATE of Texas, Appellee.
    No. 07-03-0544-CR.
    Court of Appeals of Texas, Amarillo.
    July 8, 2004.
    Rehearing Overruled Aug. 25, 2004.
    
      Ronald T. Hargesheimer, Amarillo, pro se.
    John L. Owen, Asst. Dist. Atty., for appellee.
    Before JOHNSON, C.J., and QUINN and REAVIS, JJ.
   Order of Dismissal

BRIAN QUINN, Justice.

Pending before the court is the appeal of Ronald Thacker Hargesheimer. We had remanded the cause to the trial court with directions to re-certify whether appellant had a right to appeal. The trial court complied with our directive and determined that appellant has no right of appeal. We reinstate the cause and dismiss the appeal.

According to the record, the State indicted appellant for indecency with a child. It then entered into a plea bargain with appellant. Under that bargain, the adjudication of appellant’s guilt would be deferred and he would be placed on community supervision for ten years. So too would he be ordered to pay a $1500 fine. Thereafter, the trial court entered an order deferring the adjudication of appellant’s guilt and placing him on community supervision for the period mentioned in the bargain. The State later moved to adjudicate guilt, alleging that appellant had violated several terms of his community supervision. The motion was granted. Appellant was adjudicated guilty of the original offense, and sentenced to 16 years imprisonment. He then filed a general notice of appeal.

According to the findings of fact and conclusions of law executed by the trial court upon remand, it did not give him permission to appeal. Nor did appellant state in his notice of appeal that he was appealing from an adverse ruling upon a written pretrial motion.

According to statute, a defendant generally has a right to appeal. Tex.Code CRiM. Puoc. Ann. art. 44.02 (Vernon 1979). However, if the accused was convicted upon either his plea of guilty or nolo con-tendere and the trial court assessed punishment within the range recommended by the prosecutor and agreed to by the defendant, then the defendant must have the permission of the trial court to appeal. Id. This does not apply if the substance of the appeal involves those matters raised by written motion filed prior to trial. Id. Moreover, it is clear that when a prosecutor recommends deferred adjudication in exchange for a guilty plea, the trial judge does not exceed that recommendation if, upon proceeding to an adjudication of guilt, it later assesses any punishment within the range allowed by law. Woods v. State, 68 S.W.3d 667, 669 (Tex.Crim.App.2002); Vidaurri v. State, 49 S.W.8d 880, 885 (Tex.Crim.App.2001).

Here, appellant pled guilty in exchange for being placed on deferred adjudication. The trial court acceded to the bargain. That it later sentenced him to 16 years imprisonment (after adjudicating him guilty) does not evince an instance of punishment exceeding the recommendation since the term of imprisonment fell within the range allowed by law. See Tex. Pen.Code §§ 21.11(d) & 12.33(a) (Vernon 2003) (stating that the range of punishment for the second degree felony of indecency with a child by sexual contact is not more than 20 years or less than two years). Thus, by statute, appellant had to obtain the trial court’s permission to appeal. Since he did not and since the trial court certified that he has no right to appeal, we dismiss the appeal pursuant to Texas Rule of Appellate Procedure 25.2(d) (stating that we must dismiss the appeal if the record does not contain a certification showing that the defendant has a right to appeal).

It is so ordered. 
      
      . We also denied, without prejudice, the State's motion to dismiss. It had contended that appellant waived his right to appeal. We concluded that the waiver was invalid and that the trial court could not rely upon it as basis for certifying that he had no right to appeal. Hargesheimer v. State, 126 S.W.3d 658 (Tex.App.-Amarillo 2004, pet. denied).
     
      
      . The option to appeal from an adverse ruling upon a written pretrial motion was lost when appellant did not appeal immediately after the adjudication of his guilt was deferred and the trial court placed him on community supervision. See Daniels v. State, 30 S.W.3d 407, 408 (Tex.Crim.App.2000).
     