
171 Ariz. 258 (1992)
830 P.2d 470
COCHISE COUNTY, a body corporate and politic of the State of Arizona, Plaintiff/Appellant,
v.
Leonard J. KIRSCHNER, Director of the Arizona State Health Care Cost Containment System Administration; Douglas R. Norton, Auditor General of Arizona; Ray Rottas, Treasurer of Arizona, Defendants/Appellees.
No. 2 CA-CV 92-0045.
Court of Appeals of Arizona, Division 2, Department B.
April 23, 1992.
Alan K. Polley, Cochise County Atty. by Paul A. Smith, Bisbee, for plaintiff, appellant.
Johnston Maynard Grant & Parker by Logan T. Johnston and Terry J. Fong, Phoenix, for defendant, appellee Kirschner.
Office of Auditor Gen. by Jeffrey P. Larson, Phoenix, for defendant, appellee Norton.
*259 Grant Woods, Atty. Gen. by David Rich, Phoenix, for defendant, appellee Rottas.

OPINION
FERNANDEZ, Presiding Judge.
This case involves a dispute between Cochise County and Leonard Kirschner, the director of the Arizona Health Care Cost Containment System (AHCCCS); the auditor general; and the state treasurer concerning the propriety of the AHCCCS director's determination of Cochise County's assessment for AHCCCS's long-term care system. Kirschner filed a motion to dismiss the appeal except as to the award of attorney's fees against Cochise County and the dismissal of its counterclaim to Kirschner's counterclaim, based on his contention that the balance of the appeal issues are moot. We deny that motion, finding that the issue is not moot both because the issues raised by Cochise County, ones of statewide importance, have never been decided and because the issue will likely arise again since the procedures involved are still utilized to determine AHCCCS assessments.
In 1987, the legislature created the Arizona long-term care system as part of the AHCCCS program. A.R.S. § 36-2932. Monies for the long-term care fund are contributed in part by the counties based upon expenditures they have previously made for such care. A.R.S. §§ 36-2913(C) and 11-292(A). Pursuant to an amendment enacted in 1988, the counties' respective shares for 1989-1990 were to be based on the auditor general's certified audit of the proportion that each county's net expenditures in fiscal year 1987-1988 bore to the total expenditures of all the counties for that year. A.R.S. § 11-292(A)(3)(b). The director of AHCCCS is required to notify each county of the amount of its contribution as determined by the audit so that the county board of supervisors can include the amount in its annual budget and tax levy. A.R.S. § 11-292(J).
After Cochise County was notified of the amount of its required 1989-1990 long-term care contribution, it wrote both the auditor general and the director of AHCCCS, complaining that the methodology the auditor general had employed to prepare the audit was flawed. The county filed a declaratory judgment action in July 1989 after it received no satisfactory response to its complaints.
PROCEEDINGS BELOW
The AHCCCS director filed a motion to dismiss, arguing that the trial court lacked subject matter jurisdiction because Cochise County had failed to exhaust its administrative remedies. Both the treasurer and the auditor general joined in the motion. The trial court granted the motion without oral argument.
Cochise County filed a motion to set aside the dismissal, which it later withdrew. Twenty days after the court granted the motion to dismiss but before the judgment was signed and entered and while the county's motion was still pending, Kirschner filed a counterclaim, alleging that Cochise County had refused to pay any of the contributions it was required to make either for the long-term care fund or for the AHCCCS funds because of its dispute about the audit report. Cochise County then moved to dismiss the counterclaim, contending that the court had no subject matter jurisdiction over the counterclaim because it had dismissed the complaint. The court denied the motion, stating in part as follows:
In reviewing the Rules of Civil Procedure and the authorities cited to the Court, the Court can think of no rational reason why the counterclaim should be dismissed. The counterclaim, in and of itself, states a claim upon which relief can be granted and can exist separate and apart from plaintiff's complaint. Although it may not have been brought in the procedurally usual manner, it would seem a waste of time and resources to dismiss the counterclaim simply because the complaint has been dismissed and require the filing of a new lawsuit by defendants.
The county then filed a reply to the counterclaim and a counterclaim to the counterclaim, *260 alleging that AHCCCS had collected excessive contributions from the counties to which it was not entitled and seeking an accounting of both the AHCCCS and the long-term care funds. The court subsequently granted Kirschner's motion to dismiss Cochise County's counterclaim to the counterclaim and awarded Kirschner attorney's fees of $1,730, pursuant to A.R.S. § 12-349, on the ground that the counterclaim had raised identical issues that had previously been dismissed.
The court also granted partial summary judgment to Kirschner on his counterclaim, finding that Cochise County owed the treasurer $376,798.77 for AHCCCS funds after the offset of sales tax funds that the state owed the county. Prior to Kirschner's application for attorney's fees, Cochise County moved for the entry of a formal judgment, informing the court that the state treasurer had notified the county that the long-term care fund assessment had been fully satisfied from sales tax revenues and that the county was instead owed $88,567.63 in excess funds paid to AHCCCS. The judgment that was subsequently entered reflects only that Kirschner was awarded partial summary judgment; it does not refer to any monies owed by Cochise County.
FAILURE TO EXHAUST ADMINISTRATIVE REMEDIES
Cochise County contends that the trial court erred in dismissing its complaint based on Kirschner's argument that A.R.S. § 36-2903.01(B)(4) and Ariz. Admin.Code R9-22-804 required the county to exhaust its administrative remedies. Cochise County argues on appeal that neither the statute nor the regulation applies to its declaratory judgment action. An issue of statutory construction is a question of law; thus, our review is de novo. Marsoner v. Pima County, 166 Ariz. 486, 803 P.2d 897 (1991); Tovrea Land & Cattle Co. v. Linsenmeyer, 100 Ariz. 107, 412 P.2d 47 (1966). We agree with Cochise County's contention and reverse.
The well-established rule is that when a statute or regulation provides a hearing and review process to parties before an administrative agency, the failure to pursue that process precludes judicial review of a dispute. Sanchez-O'Brien Minerals Corp. v. State, 149 Ariz. 258, 717 P.2d 937 (App. 1986). The reason for the doctrine is "`to allow an administrative agency to perform functions within its special competence  to make a factual record, to apply its expertise, and to correct its own errors so as to moot judicial controversies.'" Farmers Investment Co. v. Arizona State Land Department, 136 Ariz. 369, 373, 666 P.2d 469, 473 (App. 1982), quoting Parisi v. Davidson, 405 U.S. 34, 37, 92 S.Ct. 815, 818, 31 L.Ed.2d 17, 25 (1972).
A.R.S. § 36-2903.01(B)(4)[1] reads as follows:
[The AHCCCS director shall b]y rule establish a grievance and appeal procedure for use by providers, nonproviders who submit claims for payment for hospitalization and medical care to the system or to providers, counties, members, eligible persons, those persons who apply to be providers and those persons who apply to be members, including persons who have been determined to be ineligible for system coverage by a county eligibility worker or a special eligibility officer. Grievance procedures for providers and nonproviders shall cover grievances arising pursuant to this article. The grievance and appeal procedure shall contain provisions related to the notice to be provided to aggrieved parties, including notification of final decisions, complaint processes and internal appeals mechanisms. Any grievance and appeal procedure not specified pursuant to this paragraph, but identified pursuant to title 41, chapter 6, also applies.... If a person is dissatisfied with the final decision, the person may file for judicial review under title 12, chapter 7, article 6.
*261 Pursuant to the statute, the director adopted Ariz. Admin.Code R9-22-804, which provides, in pertinent part, as follows: "A. The provisions of this Section provide the exclusive manner through which contractors, providers, noncontracting providers, their agents and subcontractors, nonproviders, and the counties, may grieve against the [AHCCCS] Administration and its contractors in connection with any adverse action, decision, or policy." The grievance procedure provides for an investigation and written decision by the administration and for an appeal by a request for a hearing to be conducted by an AHCCCS hearing officer, a recommended decision by the hearing officer, and a decision by the AHCCCS director.
In this case, Cochise County sought a declaratory judgment that the audit performed by the auditor general was void and an order that the assessment against it be based on a correct audit. The auditor general is appointed by the joint legislative budget committee and serves at the pleasure of the legislature. A.R.S. § 41-1279.01. The director of AHCCCS, on the other hand, is appointed by the governor and confirmed by the senate. A.R.S. § 36-2902(B). Our first inquiry, then, is to determine the type of controversy involved here and whether it is one that comes within the grievance procedures established by AHCCCS.
The AHCCCS grievance statute refers specifically to "claims for payment for hospitalization and medical care," to persons who apply to be providers, to AHCCCS members, and to persons who apply to be members. A.R.S. § 36-2903.01(B)(4). Counties are mentioned in the statute but not in any specific context.
As Cochise County points out, however, counties do participate in the AHCCCS system. As a result, they can make claims for payment for services provided. A.R.S. § 36-2904. In addition, they have a role in the determination of the eligibility of persons who apply to be members of the AHCCCS system and can be involved in a grievance related to that determination. A.R.S. § 36-2905(E). Finally, grievances can arise because of AHCCCS's obligation to monitor counties' eligibility certifications. A.R.S. §§ 36-2905.01 and -2905.02. In those situations, the grievance statute clearly applies, and counties must exhaust their administrative remedies before they file suit.
The controversy in this case, however, arose out of a procedure mandated by A.R.S. § 11-292, a section in a title that governs counties. The AHCCCS director's role in that procedure is governed by § 11-292(J), which reads as follows: "The director of the Arizona health care cost containment system administration shall notify each county of the amount determined pursuant to subsection A, paragraph 3 of this section to be included in its annual budget and tax levy." Subsection A, paragraph 3 of § 11-292 requires the auditor general to prepare a certified audit of the county's expenditures. There is no indication in the statute that the AHCCCS director has any discretion in determining the amount the counties must pay. Indeed, Kirschner argued below that he has no discretion in the matter. We find no indication in A.R.S. § 36-2903.01(B)(4) that the legislature intended the director of AHCCCS either to be the legal arbiter of the meaning of A.R.S. § 11-292(A)(3)(b) or to determine whether the auditor conducted the audit according to proper methodology.
Kirschner argued below and the trial court ruled that Cochise County was required to pursue a grievance with AHCCCS because the regulation adopted pursuant to § 36-2903.01(B)(4) states that the grievance procedure is the exclusive remedy by which counties and others can complain of adverse AHCCCS decisions. Ariz. Admin. Code R9-22-804(A). An agency, however, has no powers other than those the legislature has delegated to it.
It is fundamental in administrative law that an administrative agency or commission must exercise its rule-making authority within the grant of legislative power as expressed in the enabling statutes. Any excursion by an administrative body beyond the legislative guidelines is treated as an usurpation of constitutional *262 powers vested only in the major branch of government.
Swift & Co. v. State Tax Commission, 105 Ariz. 226, 230, 462 P.2d 775, 779 (1969), overruled on other grounds, Pittsburgh & Midway Coal Mining Co., 161 Ariz. 135, 776 P.2d 1061 (1989); see also Hernandez v. Frohmiller, 68 Ariz. 242, 204 P.2d 854 (1949). The language of the regulation, therefore, cannot confer any authority upon Kirschner beyond what appears in the statute.
The dispute in this case was between two government entities about the manner in which an audit mandated by law to be conducted by a third government entity was actually conducted. This type of dispute must be resolved in the courts unless the legislature has, pursuant to its constitutional authority, explicitly assigned another forum to resolve the issue. Without resolving any of the constitutional issues Cochise County has raised about the legislature's authority in this instance, we conclude that A.R.S. § 36-2903.01(B)(4) does not explicitly assign to AHCCCS any authority to resolve the dispute involved here.
Kirschner relies in part on the case of Zeigler v. Kirschner, 162 Ariz. 77, 781 P.2d 54 (App. 1989), as support for his contention that Cochise County was required to exhaust its administrative remedies. That case involved a challenge to the procedures AHCCCS used in auditing and monitoring the counties' eligibility determinations. The court observed that the plaintiffs could have argued in an administrative appeal of the denial of eligibility that Pima County's documentation requirements exceeded the AHCCCS director's authority. The plaintiffs in that case, however, were persons who had been determined to be ineligible for AHCCCS benefits. The grievance process is expressly aimed at such persons. A.R.S. § 36-2903.01(B)(4); see also St. Mary's Hospital and Health Center v. State, 150 Ariz. 8, 721 P.2d 666 (App. 1986).
In this case, however, a separate state entity was charged by statute with performing an audit whose findings would then serve as the basis of another state entity's determination of the counties' assessment. We conclude that the only proper forum for a challenge of that process was superior court, the forum Cochise County utilized. Therefore, the trial court erred in ruling that it lacked subject matter jurisdiction over Cochise County's complaint.
VALIDITY OF COUNTERCLAIM
After the trial court dismissed Cochise County's complaint, it permitted Kirschner to file and pursue his counterclaim. Kirschner argues that his counterclaim was valid because it was filed before the formal order of dismissal was entered. We disagree. Once the court ruled that it lacked subject matter jurisdiction over the complaint, there was no pending action in which Kirschner could file a counterclaim, regardless of whether a formal order of dismissal had been entered. Indeed, the trial court implicitly acknowledged the fact that the complaint no longer existed when it ruled that the counterclaim could exist separately from the complaint and that it "seem[ed] a waste of time and resources" to make Kirschner file it as a new action. Subject matter jurisdiction, however, is not a matter of judicial economy nor can the lack of it be waived. Porter v. Porter, 101 Ariz. 131, 416 P.2d 564 (1966), cert. denied, 386 U.S. 957, 87 S.Ct. 1028, 18 L.Ed.2d 107 (1967); Leon v. Numkena, 142 Ariz. 307, 689 P.2d 566 (App. 1984).
We find that the trial court had no jurisdiction to permit Kirschner's counterclaim. As a result, we vacate all actions the court took after it dismissed the complaint, including the award of attorney's fees against Cochise County.
Reversed and remanded.
HATHAWAY and DRUKE, JJ., concur.
NOTES
[1]  Because the current version of the statute differs from the version applicable in this case only in the addition of a specific time requirement for the rendering of decisions, an addition not at issue here, we quote the current version in our discussion.
