
515 S.E.2d 307 (1999)
30 Va. App. 1
Javier Jerome BATTS
v.
COMMONWEALTH of Virginia.
Record No. 0592-98-4.
Court of Appeals of Virginia, Alexandria.
June 8, 1999.
*309 Michael F. Devine, for appellant.
Donald E. Jeffrey, III, Assistant Attorney General (Mark L. Earley, Attorney General, on brief), for appellee.
Present: FITZPATRICK, C.J., LEMONS, J., and DUFF, Senior Judge.
*308 FITZPATRICK, Chief Judge.
Javier Jerome Batts (appellant) was convicted in a jury trial of the use of a firearm in the commission of a robbery, in violation of Code § 18.2-53.1.[1] On appeal, he contends the trial court erred in instructing the jury to impose an enhanced punishment of five years for a second offense firearm conviction. For the following reasons, we vacate the five-year sentence reflecting the enhanced punishment and remand with instructions to enter an order imposing a three-year sentence on appellant's firearm conviction.

I. BACKGROUND
On April 21, 1997, appellant was indicted for the robbery of Andrea A. Thomas and the use of a firearm in the commission of robbery.[2] A jury trial was set for August 6, 1997. Appellant filed a pretrial motion in limine seeking to prevent the Commonwealth from using an earlier firearm conviction *310 as the predicate for imposing an enhanced penalty. In the earlier case, the jury returned a guilty verdict and although sentencing was set prior to the August 6 trial date in the instant case, Judge Stevens continued the sentencing hearing in that case at the request of appellant's trial counsel.[3]
Appellant argued that because no final sentencing order had been entered on the earlier firearm conviction, the jury should have been instructed only as to the first offender sentence of three years. At that time, the trial court indicated it would resolve the dispute after the presentation of evidence. The Commonwealth then moved for a continuance, arguing that appellant should not be allowed to "manipulate the court system" by requesting ex parte a continuance of the first firearm sentencing hearing in order to avoid the enhanced punishment in the instant case. Noting that trial counsel's actions "put the Commonwealth in a bind," the trial judge initially granted the motion to continue.
In an extended colloquy between the trial judge and appellant's counsel, counsel objected both to the continuance and the proposed jury instruction on the enhanced five-year punishment for the firearm charge.[4] Appellant *311 ultimately "conceded the point" and "agreed" to the five-year jury instruction rather than have the matter continued. At the conclusion of the evidence, the trial court reviewed the Commonwealth's proposed Instruction G, which contained the mandatory five-year sentence on the firearm charge. When the trial judge asked counsel if he had any objection to the proposed instruction, counsel stated, "That's acceptable." The jury subsequently convicted appellant of the firearm offense and recommended the "five years mandatory fixed" sentence.
Judge Alden continued the case to November 21, 1997, for the imposition of sentence. Prior to that time, Judge Stevens set aside the jury verdict on the firearm conviction in the first, unrelated case. Accordingly, appellant filed a motion to set aside the verdict in the instant case, alleging that the jury instruction was improper because it contained the enhanced punishment of five years.
On October 31, 1997, after the trial in the instant case but before the scheduled sentencing hearing, appellant was convicted of two additional firearm offenses resulting from another unrelated crime. In that case, the trial judge sentenced him to three years on the first offense and five years on the second offense.
At the sentencing hearing in the present case, Judge Alden denied appellant's motions to set aside the verdict and imposed the mandatory five-year sentence. The trial judge found as follows:
All right, well, I've considered the pre-sentence report in this case, the sentencing guidelines, the jury recommendation, counsel's arguments. Mr. Batts, I've considered your letter and the other facts and circumstances regarding the case.
And I conclude that the instruction, when given, was correct. Now, after the correct instruction was given, circumstances changed, which might have allowed me at a sentencing proceeding to exercise my discretion or may have required me to  I don't know  to impose a lesser sentence *312 than that the jury had imposed at the time it was instructed.
However, as it's turned out in this case, I guess, it has gone full circle because even though the facts changed after the jury was properly instructed, by the time you get to the sentencing day, the facts have gone all the way around again and have come back to the beginning. So, I conclude, based on all of that, that the jury was properly instructed and that today the sentence of the jury is the proper sentence to impose.
Accordingly, the trial judge imposed the five-year sentence on the firearm charge.

II. JURY INSTRUCTION
Appellant contends that at the time the jury was instructed to impose the mandatory five-year sentence for a second firearm offense, there was no predicate conviction because a final order had not been entered on the earlier firearm offense. Because the jury was instructed to impose a sentence greater than that authorized by statute, the instruction was erroneous even though it was approved by appellant's counsel.
"[An appellate] court's responsibility in reviewing jury instructions is to see that the law has been clearly stated and that the instructions cover all issues which the evidence fairly raises. It is elementary that a jury must be informed as to the essential elements of the offense; a correct statement of the law is one of the essentials of a fair trial." Darnell v. Commonwealth, 6 Va.App. 485, 488, 370 S.E.2d 717, 719 (1988) (internal quotations and citations omitted). "[W]hen a principle of law is vital to a defendant in a criminal case, a trial court has an affirmative duty properly to instruct a jury about the matter." Jimenez v. Commonwealth, 241 Va. 244, 250, 402 S.E.2d 678, 681 (1991).
At the time of trial in the instant case, appellant had not been sentenced on the earlier firearm offense pending before Judge Stevens. Trial counsel admitted in the colloquy with Judge Alden that "[he] called Judge Stevens" to get a continuance in that case. Alleging that appellant sought that continuance for tactical reasons, the Commonwealth's attorney in the present case moved for a continuance, pending the outcome of the first case. While Judge Alden was "considering granting the motion for a continuance," trial counsel said he would "concede the point" and agreed to the instruction. Subsequently, when the trial judge asked counsel if he had any objection to the firearm instruction, Instruction G, counsel said, "That's acceptable." It is in this fast and loose climate that appellant contends the jury was improperly instructed.
A party may not invite error and subsequently raise that error as grounds for appeal. "[A] defendant, having agreed upon the action taken by the trial court, should not be allowed to assume an inconsistent position. No litigant, even a defendant in a criminal case, will be permitted to approbate and reprobate  to invite error ... and then to take advantage of the situation created by his own wrong." Manns v. Commonwealth, 13 Va.App. 677, 679-80, 414 S.E.2d 613, 615 (1992) (citations omitted). Trial counsel agreed to the proposed jury instruction and, thus, became a party to the error he now complains of on appeal. However, his agreement cannot confer the power to impose a sentence greater than that established by the legislature. The penalty exceeded that authorized by statute and, therefore, we hold that the jury was improperly instructed. Code § 18.2-53.1 makes it unlawful for any person to use or display a firearm while committing one of the enumerated felonies. That section provides:
It shall be unlawful for any person to use or attempt to use any pistol, shotgun, rifle, or other firearm or display such weapon in a threatening manner while committing or attempting to commit murder, rape, forcible sodomy, inanimate or animate object sexual penetration as defined in § 18.2-67.2, robbery, carjacking, burglary, malicious wounding as defined in § 18.2-51, malicious bodily injury to a law-enforcement officer as defined in § 18.2-51.1, aggravated malicious wounding as defined in § 18.2-51.2, malicious wounding by mob as defined in § 18.2-41 or abduction. Violation of this section shall constitute a separate and distinct felony and any person found guilty thereof shall be sentenced to a *313 term of imprisonment of three years for a first conviction, and for a term of five years for a second or subsequent conviction under the provisions of this section.
Code § 18.2-53.1 (emphasis added). The statute is recidivist in nature because it is "aimed at punishment of specific behavior, not reform." Stubblefield v. Commonwealth, 10 Va.App. 343, 347, 392 S.E.2d 197, 198 (1990).
Based on the evidence before the trial court, Instruction G provided an incorrect statement of law because it instructed the jury on the enhanced punishment provision for a "second or subsequent conviction" in the absence of proof of a first conviction. A final sentencing order was a necessary predicate to this action, and Judge Stevens had not entered one on the earlier firearm offense. The jury's verdict in that case was not a final conviction without the entry of the sentencing order and, therefore, could not be used to establish the predicate first offense. See Ramdass v. Commonwealth, 248 Va. 518, 520, 450 S.E.2d 360, 361 (1994), cert. denied, 514 U.S. 1085, 115 S.Ct. 1800, 131 L.Ed.2d 727 (1995). In Ramdass, our Supreme Court considered whether the defendant's prior conviction for armed robbery made him ineligible for parole. The Court concluded: "Judgment had not been entered on that verdict; therefore, it cannot be considered as a conviction under [the applicable Code provision]." Id. (emphasis added); see also Miller v. Commonwealth, 22 Va.App. 497, 500 n. 3, 471 S.E.2d 780, 781 n. 3 (1996) (citing Ramdass) ("A guilty verdict is not a conviction until a final order of judgment has been entered.").
There being no evidence to support the enhanced punishment provided in Code § 18.2-53.1, the jury did not have the statutory authority to impose a five-year sentence for a first time offender, even with the acquiescence of appellant's attorney.[5] "Where the sentence imposed is in excess of that prescribed by law, that part of the sentence which is excessive is invalid." Deagle v. Commonwealth, 214 Va. 304, 305, 199 S.E.2d 509, 510 (1973) (citing Crutchfield v. Commonwealth, 187 Va. 291, 46 S.E.2d 340 (1948)). "A sentence in excess of one prescribed by law is not void [a]b initio because of the excess, but is good insofar as the power of the court extends, and is invalid only as to the excess." Id. at 305, 199 S.E.2d at 510-11 (citing Royster v. Smith, 195 Va. 228, 77 S.E.2d 855 (1953)).
"If an illegal sentence has been pronounced, the court has [the] power to substitute a legal sentence, ... the imposition of the void sentence does not terminate the jurisdiction of the court." Powell v. Commonwealth, 182 Va. 327, 340, 28 S.E.2d 687, 692 (1944) (citations omitted). "A void sentence does not invalidate a prior adjudication of guilt properly had; but, on the contrary, such adjudication furnishes a basis for the imposition of a valid sentence when the invalidity of the sentence imposed is called to the attention of the court." Carter v. Commonwealth, 199 Va. 466, 470, 100 S.E.2d 681, 684 (1957). In the instant case, at the time the jury returned a guilty verdict and recommended the five-year punishment, it did not have the statutory authority to sentence appellant to any term greater than three years. *314 Accordingly, any sentence in excess of the statutory mandate of three years is void.

III. HARMLESS ERROR
The Commonwealth argues that any error in Instruction G was harmless because appellant received two subsequent final firearm convictions on October 31, 1997, before the trial judge imposed the instant five-year sentence. Relying on Miller, 22 Va. App. 497, 471 S.E.2d 780, the Commonwealth contends that those subsequent convictions can be used as the predicate for an enhanced punishment in the instant case. The Commonwealth concludes that any error in the jury instruction was harmless because the trial judge ultimately possessed the authority under Miller to impose the five-year sentence based upon the "subsequent" convictions.
Our determination of whether the error is harmless is guided by familiar principles. Non-constitutional error "is harmless `[w]hen it plainly appears from the record and the evidence given at the trial that the parties have had a fair trial on the merits and substantial justice has been reached.'" Lavinder v. Commonwealth, 12 Va.App. 1003, 1005, 407 S.E.2d 910, 911 (1991) (en banc) (quoting Code § 8.01-678) (emphasis added in Lavinder). To determine whether an error is harmless, we "must review the record and the evidence and evaluate the effect the error may have had on how the finder of fact resolved the contested issues." Id. at 1007, 407 S.E.2d at 912. "An error does not affect a verdict if a reviewing court can conclude, without usurping the jury's fact finding function, that, had the error not occurred, the verdict would have been the same." Id. at 1005, 407 S.E.2d at 911.
Applying the standard articulated in Lavinder, we cannot conclude that the erroneous jury instruction and the trial court's imposition of the five-year sentence was harmless. Although we concluded in Miller that the trial court properly imposed the enhanced punishment in that case, Miller, unlike appellant, was tried in a bench trial. In Miller, we held that the trial judge properly imposed the five-year sentence where an unrelated firearm conviction was entered after the judge's finding of guilt but four days before he imposed the sentence.
Because Code § 18.2-53.1 is concerned with punishing repeat firearm offenders, the statute punishes for a "second or subsequent conviction" without regard to the dates of the convictions or the sequence in which the offenses were committed. "Any conviction that follows a first conviction is a subsequent conviction within the purview of Code § 18.2-53.1."
Miller, 22 Va.App. at 501-02, 471 S.E.2d at 782 (citations omitted) (emphasis added). Therefore, we concluded "that the relevant inquiry under Code § 18.2-53.1 is whether, at the time of sentencing, a conviction entered is a `second or subsequent' conviction." Id. at 502, 471 S.E.2d at 782 (emphasis in original).
The decision in Miller, which involved a bench trial, is not inconsistent with our decision in the present case. A jury may use only those convictions that are final at the time it returns its verdict and determines the appropriate sentence. There was no predicate offense in this case when the jury recommended the enhanced punishment because judgment had not been entered on the earlier firearm conviction pending before Judge Stevens and the October 1997 convictions had not occurred.
We recognize that Virginia law has historically maintained a clear distinction between the roles played by judge and jury in criminal sentencing. See Duncan v. Commonwealth, 2 Va.App. 342, 345, 343 S.E.2d 392, 394 (1986). "Under the statutory scheme, the jury determines the guilt or innocence of the accused. If the jury finds that he is guilty, it then `ascertains' or `fixes' the maximum punishment in accordance with contemporary community values and within the limits established by law." Id. (emphasis added). "After conviction, ... the court may suspend imposition of sentence or suspend the sentence in whole or part...." Code § 19.2-303.
"[T]he punishment as fixed by the jury is not final or absolute, since its finding on the proper punishment is subject to suspension *315 by the trial judge, in whole or in part, on the basis of any mitigating facts that the convicted defendant can marshal. The verdict of the jury is the fixing of maximum punishment which may be served. Under such practice, the convicted criminal defendant is entitled to `two decisions' on the sentence, one by the jury and the other by the trial judge in the exercise of his statutory right to suspend; his `ultimate sentence ... does not [therefore] rest with the jury' alone but is always subject to the control of the trial judge. This procedure makes the jury's finding little more than an advisory opinion or first-step decision. Any criticism of jury sentencing because it lacks the objectivity and principled decision of a judge is thus overcome by the existence of the power in the trial judge to bring his so-called superior judgment to bear upon the issue of proper punishment in reaching his decision whether to suspend the sentence or not."
Duncan, 2 Va.App. at 345, 343 S.E.2d at 394 (quoting Vines v. Muncy, 553 F.2d 342, 349 (4th Cir.1977)) (emphasis added). Clearly, the trial judge may reduce a sentence but may not exceed the "maximum punishment" fixed by the jury.
In the instant case, notwithstanding trial counsel's acquiescence and agreement to the erroneous jury instruction, we cannot conclude that the error was harmless. Appellant was subjected to a maximum mandatory sentence that was not authorized at the time the jury determined his "maximum punishment." Id. While a trial judge may have the authority under Code § 19.2-303 to reduce a jury's recommended sentence,[6] he or she does not have the authority to impose a sentence greater than the one recommended by the jury.[7] The trial court is required to properly instruct the jury as to a correct statement of the applicable punishment range as of the time of trial. Because the jury was instructed to impose a sentence greater than that authorized, that portion in excess of the statutory maximum of three years is vacated and the case is remanded to the trial court to enter an order consistent with this opinion and in accordance with the first offender provisions of Code § 18.2-53.1.[8]
Reversed and remanded.
NOTES
[1]  Appellant was also convicted of robbery, in violation of Code § 18.2-58.
[2]  Patrick N. Anderson represented appellant in the proceedings before Judge Stevens in the earlier firearm case and in the trial court proceedings in the instant case. Different counsel was appointed for this appeal.
[3]  The Commonwealth received no notice and did not participate in the motion for continuance of the sentencing before Judge Stevens.

[COMMONWEALTH]: ... [Appellant] was supposed to get sentenced last week. Unbeknownst to the Commonwealth, it got bumped. Mr. Sanders from our office was there ready to argue [the sentencing before Judge Stevens] and was told from the Bench, "Well, that's been moved to September."
Appellant's trial counsel conceded that he called Judge Stevens to request a continuance in the first case.
THE COURT: How did the case get moved from Friday?
[COMMONWEALTH]: That would be a great question. I wish I knew the answer.
THE COURT: Mr. Anderson, do you know?
[COUNSEL]: I called Judge Stevens.... I did call Judge Stevens. There were several reasons.
THE COURT: Mr. Anderson, it doesn't really matter [why] it was continued. Why it was continued doesn't really matter....
[4]  The following colloquy occurred:

[COUNSEL]: ... My client is ready to go to trial here today.
THE COURT: Well, you can note your exception.
[COUNSEL]: Well, if I may, before you make this decision, let me tell my client exactly what's going on here because, I'm sure he doesn't understand 
THE COURT: All right.
[COUNSEL]:  and see what he wants to do.
(Counsel confers with Defendant.)
[COUNSEL]: Judge, just so I understand, are you refusing to make a decision on this issue?
THE COURT: Well, Mr. Anderson, I've granted  or, I'm considering granting the motion for a continuance. I've given you an opportunity to be heard on it. If there's anything else you'd like to say, I'll be happy to hear it.
[COUNSEL]: Well, before we get to the continuance, what I'm trying to determine is  I mean, if the Court is just continuing the matter because they refuse to rule on the motion, which I think is improper, I think that we need to make a decision on the issue.
I mean  if you make a decision one way or the other, then Mr. Murphy can either make his determination whether he wants a continuance, but I don't think it's right or fair for anybody for the Court to say, "Well, I can't make this decision. I'm just going to continue the case."
* * * * * *
THE COURT: Well, Mr. Anderson, I understand perfectly your position. Is there anything else that you'd like to say about the motion for a continuance?
[COUNSEL]: Well, then this is what I'm going to have to do, and this is kind of odd. I'm obviously going to note my exception to what's going on; but, then, for purposes of protecting my client, I'll just concede that you can use the five years then, because my client is going to be better protected now than waiting until after September, when all the other stuff is going to be final.
So, if the Court's not willing to make a ruling, which I think is improper and I do object to that  that's why we have this system  then, I'm forced to make a determination of what's the least burden to put on my client.
The Court is basically ordering me to tell my client what's the least exposure you're going to have, and that is very improper, and I note a big exception to that. But, if that's the way we are today, then I have no choice but to say let Mr. Murphy use the five years.
He can't say there was a second prior conviction now, and I guess, if we have to, we'll deal with it later in the Appeals Court, but I can't agree to the continuance.
THE COURT: Mr. Murphy, is there anything you'd like to add?
[COMMONWEALTH]: Your Honor, if counsel would rather concede the legal point than see a continuance granted, that's fine with me.
[COUNSEL]: Well, I'm not conceding a legal point, but we are going to go forward. That five years is going to go into the jury instruction, but I'm not conceding it and I'm noting an exception to it, but it will be in the jury instruction.
THE COURT: Well, I'm not sure you can have it both ways, Mr. Anderson. If you don't want to agree to it being five years in the jury instruction, you don't have to. On that condition, I'm granting the Commonwealth's motion for a continuance. I mean, it's as simple as that.
I know you disagree with me, but please tell me how you'd like to proceed at this point.
[COUNSEL]: Well, if I may then, Judge, you tell me I can't have it both ways, but the Court wants it both ways. I respectfully say this to you. I'm not trying to be 
THE COURT: Mr. Anderson, I've ruled. Is there anything else you'd like to add with regard to whether you'll agree or not agree?
[COUNSEL]: Then I will be forced to concede the point, but I'm noting my exception that I'm being forced to concede the point, but I will concede the point. That I can do.
THE COURT: All right. Well, then you've conceded the point.
[COUNSEL]: But I'm noting my exception to being forced, here.
[COMMONWEALTH]: I object to this, Your Honor. I object to it.
THE COURT: All right. Let's agree on a date for a continuance.
[COUNSEL]: Well, Judge, I'm conceding the point. The fact 
THE COURT: Mr. Anderson, I don't want to argue about it any further. You don't have to agree to it, and if you don't agree to it 
[COUNSEL]: But I am agreeing to it. I just said I would agree to it.
THE COURT: Well, then the record will reflect that you're agreeing to it, not that you're agreeing to it but objecting to it.
[COUNSEL]: I'm not doing that. You said I couldn't do that, and I'm not doing that. I said I would agree to the legal point, but there's a difference by saying that I note an exception that I'm being put in that position. That's different. Isn't that fair?
THE COURT: How about September 16th?
[COUNSEL]: Well, if you're not going to let me do that either, then I'll just concede the point. I mean, I have no choice, Judge. So, I will concede the point. If you're not going to let me note an exception to anything, then I'll just concede the point.
THE COURT: You can note an exception to anything you'd like to, but 
[COUNSEL]: I'm not going to note an exception if that's going to cause you to continue the case.
[COMMONWEALTH]: September 16th is fine with us.
[COUNSEL]: I'm not going to note any exception if that's going to cause you to continue this case. I will concede the point, and we'll move forward.
THE COURT: All right. Then let's bring the jury in.
(Emphasis added).
[5]  Our decision to vacate appellant's five-year sentence is based solely upon the lack of authority of a jury to sentence a defendant to a period greater than that statutorily mandated. Appellant's argument that he was "forced" either to accept the improperly enhanced punishment or suffer a continuance is without merit. It is well settled that the decision whether to grant a continuance is a matter within the sound discretion of the trial court. See Lebedun v. Commonwealth, 27 Va.App. 697, 712, 501 S.E.2d 427, 434 (1998); Price v. Commonwealth, 24 Va.App. 785, 788, 485 S.E.2d 655, 657 (1997). Indeed, we have previously held that a trial court may properly grant a continuance where the moving party has been the victim of surprise. See Lyles v. Commonwealth, 21 Va.App. 187, 191, 462 S.E.2d 915, 917 (1995) (affirming decision to grant a continuance where the moving party was surprised by defendant's trial tactics); see also Bennett v. Commonwealth, 236 Va. 448, 460-61, 374 S.E.2d 303, 311 (1988) ("Ambush, trickery, stealth, gamesmanship, one-upmanship, surprise have no legitimate role to play in a properly conducted trial."), cert. denied, 490 U.S. 1028, 109 S.Ct. 1765, 104 L.Ed.2d 200 (1989). Although the trial judge in the instant case could have granted the continuance for good cause, including that the Commonwealth was "put in a bind" by counsel's "surprise" trial tactics, she did not do so because counsel agreed to proceed with trial.
[6]  The trial judge cannot reduce a statutorily mandated sentence.
[7]  Code § 19.2-295.2, which provides that the trial court has the option of imposing an additional six months to three years of suspended sentence, is inapplicable to the instant case. See Allard v. Commonwealth, 24 Va.App. 57, 67-68, 480 S.E.2d 139, 143-44 (1997).
[8]  Appellant also contends that proof of a prior conviction under Code § 18.2-53.1 constitutes an element of that offense, which the Commonwealth must prove in order to impose the enhanced punishment. He argues that Instruction G was improper because it did not instruct the jury that it was required to find that appellant had previously been convicted of a firearm offense before recommending the enhanced five-year punishment. We do not address the merits of appellant's argument because he did not raise this issue before the trial court and is precluded from raising it on appeal. See Rule 5A:18.
