Ronald R. Cline, respondent, appeals the decision of the district court denying his motion to vacate, terminate, or reduce his obligation to pay spousal maintenance to his former wife, Ranae S. Cline, petitioner.
Essentially we must resolve two issues. First, we must decide if the district court erred in ordering the respondent to pay spousal maintenance terminable only upon the death or remarriage of respondent’s former spouse. Second, even if the order of the spousal maintenance is void, should the appeal fail because of: (1) respondent’s acquiescence; (2) the doctrine of res judicata; or (3) the provisions of K.S.A. 1991 Supp. 60-1610(b)(3)?
We reverse and remand with instructions.
The undisputed facts distilled to their essence are as follows: Respondent and petitioner were married April 5, 1969, in Tennessee. Two children were bom during their marriage. In 1987, petitioner filed for divorce in Sedgwick County District Court. Respondent was living in Louisiana when petitioner filed for divorce.
*231A temporary order was issued giving temporary custody of the children to petitioner and ordering respondent to pay child support in the amount of $240 per month and spousal maintenance of $500 per month. Respondent was served by mail with notice of the divorce action and support order in Louisiana, but he did not file any responsive pleadings.
A hearing on the petition was conducted, but respondent neither appeared nor was represented by counsel. The district court entered a default judgment granting petitioner a divorce from respondent, granted the parties joint custody of their children, and ordered child support and spousal maintenance. The decree specifically provided spousal maintenance as follows:
“7. Respondent shall contribute as and for the support of the petitioner the total sum of $450.00 per month commencing on the 1st day of September, 1987, and a like sum on the 1st day of each month thereafter for twelve (12) months. Upon the expiration of the 12 month period, the respondent shall thereafter contribute as and for the support and maintenance of the petitioner the sum of $500.00 per month until death or remarriage of the petitioner. The Court finds that good cause exists for not having said support payments made to the Court Trustee. Said support shall therefore be paid through the Clerk of the District Court, Support Division and thereafter transmitted to the petitioner.”
There is no evidence that the original divorce decree incorporated any oral or written settlement agreement between the parties. Respondent maintains that he and petitioner had engaged in general discussions prior to entry of the divorce decree concerning what would be a fair division of property, debts, and support. When he received notice of the Journal Entry of Judgment and Decree of Divorce, respondent apparently felt that the decree provisions varied significantly from those terms he had previously discussed with petitioner.
Petitioner and respondent jointly moved for modification of respondent’s child support and spousal maintenance obligations. The district court granted the parties’ motion for modifications increasing child support and reducing spousal maintenance, with the maintenance remaining terminable upon petitioner’s death or remarriage. The other provisions of the previous decree continued unmodified. The court noted the modification order represented a “compromise agreement reached by the parties and constitutes an amended property settlement agreement.”
*232Later, respondent filed a motion to vacate maintenance or, in the alternative, to terminate or reduce maintenance. Both children had already reached the age of 18 and child support payments had ended. Respondent argued that K.S.A. 1991 Supp. 60-1610(b)(2) expressly forbids an order for spousal maintenance that exceeds 121 months in duration. Specifically, he argued that the court’s order, continuing maintenance until petitioner’s death or remarriage, was thus void and should be set aside.
The district court denied respondent’s motion, holding that K.S.A. 1991 Supp. 60-1610(b)(3) prohibited the court from modifying a settlement agreement; that respondent’s acquiescence in the earlier order estopped him from now challenging the order; and that the doctrine of res judicata prevented consideration of the issues raised.
Spousal Maintenance
Respondent contends that the court’s maintenance orders were void and must be set aside because they were contrary to K.S.A. 1991 Supp. 60-1610(b)(2). K.S.A. 1991 Supp. 60-1610(b)(2) provides:
“(2) Maintenance. The decree may award to either party an allowance for future support denominated as maintenance, in an amount the court finds to be fair, just and equitable under all of the circumstances. The decree may make the future payments modifiable or terminable under circumstances prescribed in the decree. The court may make a modification of maintenance retroactive to a date at least one month after the date that the motion to modify was filed with the court. In any event, the court may not award maintenance for a period of time in excess of 121 months. If the original court decree reserves the power of the court to hear subsequent motions for reinstatement of maintenance and such a motion is filed prior to the expiration of the stated period of time for maintenance payments, the court shall have jurisdiction to hear a motion by the recipient of the maintenance to reinstate the maintenance payments. Upon motion and hearing, the court may reinstate the payments in whole or in part for a period of time, conditioned upon any modifying or terminating circumstances prescribed by the court, but the reinstatement shall be limited to a period of time not exceeding 121 months. The recipient may file subsequent motions for reinstatement of maintenance prior to the expiration of subsequent periods of time for maintenance payments to be made, but no single period of reinstatement ordered by the court may exceed 121 months. Maintenance may be in a lump sum, in periodic payments, on a percentage of earnings or on any other basis. At any time, on a hearing with reasonable notice to the party affected, the court may modify the amounts or other conditions for *233the payment of any portion of the maintenance originally awarded that has not already become due, but no modification shall be made without the consent of the party liable for the maintenance, if it has the effect of increasing or accelerating the liability for the unpaid maintenance beyond what was prescribed in the original decree.” (Emphasis added.)
Respondent’s motion to vacate cited K.S.A. 60-260(b)(4), which in relevant part provides: “On motion and upon such terms as are just, the court may relieve a party or said party’s legal representative from a final judgment, order, or proceeding for the following reasons: ... (4) the judgment is void.” The statute indicates that such a motion shall be made within a “reasonable time.” K.S.A. 60-260(b). Our courts have interpreted the statute to find that a motion to set aside a void judgment can be made at any time. Barkley v. Toland, 7 Kan. App. 2d 625, 630, 646 P.2d 1124, rev. denied 231 Kan. 799 (1982).
K.S.A. 1991 Supp. 60-1610(b)(2) unambiguously states, “In any event, the court may not award maintenance for a period of time in excess of 121 months.” We must determine if the district court’s orders are void as contrary to this statute. “A judgment is not void merely because it is erroneous or because some irregularity inhered in its rendition. It is void only if the court that rendered it lacked jurisdiction of the subject matter or of the parties or if the court acted in a manner inconsistent with due process.” Producers Equip. Sales, Inc. v. Thomason, 15 Kan. App. 2d 393, Syl. ¶ 2, 808 P.2d 881 (1991). See In re Marriage of Morton, 11 Kan. App. 2d 473, 474, 726 P.2d 297 (1986).
In Morton, the district court ordered the appellant to make the annuity in his military survivor benefit plan payable to the appellee upon his death. Although there had been an. oral settlement agreement, the appellant denied that he had ever agreed to allow the appellee to receive the annuity. A federal statute, 10 U.S.C. § 1450(f)(3) (1982), expressly provided that before a court had the authority to order a military retiree to provide a former spouse with a survivor’s benefit annuity, the retiree must have voluntarily agreed in writing to do so. Because there was no such writing, the court held “the lower court acted outside its authority, or subject matter jurisdiction, by ordering appellant to elect to provide such an annuity to appellee. Therefore, that part of [the] decree ordering [appellant] to provide the SBP an*234nuity is void and should have been set aside. K.S.A. 60-260(b)(4).” (Emphasis added.) 11 Kan. App. 2d at 477.
Under the facts of this case, the district court acted outside its subject matter jurisdiction by awarding maintenance for a period that could exceed the maximum duration of 121 months imposed by statute. The portion of spousal maintenance that exceeds the statutory limit of 121 months is void as a matter of law. Clearly the district court has wide discretion in adjusting the financial obligations of the parties and ordinarily its judgments will not be disturbed absent a showing of a clear abuse of discretion: In re Marriage of Brown, 247 Kan. 152, 165-66, 795 P.2d 375 (1990). But the district court must comply with the statutes authorizing payment of support and maintenance, and its failure to do so is reversible error.
Is This Appeal Barred?
Petitioner contends, and the district court apparently agreed, that respondent’s K.S.A. 60-260(b)(4) motion should be denied due to his acquiescence in the court’s judgment, due to the doctrine of res judicata, and pursuant to the provisions of K.S.A. 1991 Supp. 60-1610(b)(3) because of that statute’s prohibition against modification of orders that incorporate a separation agreement between the parties. These issues will be separately addressed.
Res Judicata
“ 'The doctrine of res judicata prevents the splitting of a single cause of action or claim into two or more suits; it requires that all the grounds or theories upon which a cause of action or claim is founded be asserted in one action or they will be barred in any subsequent action. [Citation omitted.] This rule is one of public policy. It is to the interest of the state that there be an end to litigation and an end to the hardship on a party being vexed more than once for the same cause. The doctrine of res judicata is, therefore, to be given a liberal application but not applied so rigidly as to defeat the ends of justice. [Citation omitted.]
“ ‘An issue is res judicata when there is a concurrence of four conditions: (1) identity in the things sued for, (2) identity of the cause of action, (3) identity of persons and parties to the action, and (4) identity in the quality of the persons for or against whom the claim is made. [Citations omitted.]’ ” Ellis v. State Farm Mut. Auto. Ins. Co., 249 Kan. 599, 603, 822 P.2d 35 (1991) (quoting In re Estate of Reed, 236 Kan. 514, 519, 693 P.2d 1156 [1985]).
*235Res judicata is an affirmative defense and must be affirmatively pleaded or it is waived as a defense. K.S.A. 1991 Supp. 60-208(c); Oehme v. Oehme, 10 Kan. App. 2d 73, 77, 691 P.2d 1325 (1984), rev. denied 236 Kan. 876 (1985). We are unable to determine if petitioner raised this defense in her pleadings or if it was raised sua sponte by the district court. This is not crucial, however, because we conclude the district court’s orders were void and created no binding obligation upon the parties. Barkley v. Toland, 7 Kan. App. 2d at 629. In order for a judgment to be given former adjudicative effect, the judgment must be valid. We believe it is unreasonable to suggest that a void judgment must be given res judicata effect, precluding a court from ever setting it aside pursuant to K.S.A. 60-260(b)(4), simply because the issue of its being void was not raised at the time the judgment was entered. This would clearly defeat the ends of justice.
Modification of Agreement
K.S.A. 1991 Supp. 60-1610(b)(3) provides:
“If the parties have entered into a separation agreement which the court finds to be valid, just and equitable, the agreement shall be incorporated in the decree. The provisions of the agreement on all matters settled by it shall be confirmed in the decree except that any provisions for the custody, support or education of the minor children shall be subject to the control of the court in accordance with all other provisions of this article. Matters settled by an agreement incorporated in the decree, other than matters pertaining to the custody, support or education of the minor children, shall not be subject to subsequent modification by the court except: (A) As prescribed by the agreement or (B) as subsequently consented to by the parties.”
Petitioner contends that because the district court’s original order was modified with agreement of both the parties, K.S.A. 60-1610(b)(3) acts to prevent any subsequent modifications by the court, even of void judgments, unless consented to by both parties or unless prescribed by the agreement itself.
The record provides no evidence of a settlement agreement between the parties when the original judgment and decree was issued. The post-divorce modification simply seems to have been a subsequent modification consented to by the parties. The district court treated the parties’ mutual agreement to move for modification as a “settlement agreement” and purported to “incorporate” it into the decree.
*236Interpretation of a statute is a question of law, and it is the function of this court to interpret the statute in a manner that will give it the effect the legislature intended. In re Marriage of Schoneman, 13 Kan. App. 2d 536, 538, 775 P.2d 194, rev. denied 245 Kan. 784 (1989). We believe that the legislature did not intend every post-divorce, mutually consented-to modification to be treated as a “settlement agreement” for the purposes of K.S.A. 1991 Supp. 60-1610(b)(3). Because there was no settlement agreement, the district court erred in finding it had no authority to modify maintenance.
Acquiescence
“A party to litigation who acquiesces in the judgment of the trial court, either by assuming the burdens of such judgment or by accepting the benefits thereof, will be deemed to have acquiesced in such judgment and may not thereafter adopt an inconsistent position and appeal from such judgment. [Citation omitted.]” In re Marriage of Powell, 13 Kan. App. 2d 174, 176, 766 P.2d 827 (1988), rev. denied 244 Kan. 737 (1989).
No amount of acquiescence under the facts of this case, however, can malee a void judgment valid. See Ford v. Willits, 237 Kan. 13, 15, 697 P.2d 834 (1985) (quoting 46 Am. Jur. 2d, Judgments § 752).
We reverse and remand the cause with directions that the district court limit the maintenance award to 121 months, reserving jurisdiction to hear a motion for reinstatement for additional 121-month periods as permitted by K.S.A. 1991 Supp. 60-1610(b)(2).