
397 N.W.2d 458 (1986)
Gary L. PATTEN, Plaintiff and Appellant,
v.
Valery GREEN, Defendant and Appellee.
Civ. No. 11253.
Supreme Court of North Dakota.
December 16, 1986.
*459 Gary L. Patten, pro se; submitted on brief.
Valery Green, pro se; no appearance.
LEVINE, Justice.
Gary Patten appeals from an order dismissing his complaint for failing to state a claim upon which relief may be granted. We affirm.
Gary Patten filed a complaint against his former wife, Valery Green, alleging that she collected money from the rental of a garage and a barn during the parties' pending divorce action and used the proceeds "for her personal support when it was for other and specific purposes." The district court dismissed Patten's complaint sua sponte under Rule 12(b)(5) of the North Dakota Rules of Civil Procedure.
The district court may, on its own initiative, and in the cautious exercise of its discretion, dismiss a complaint for failure to state a valid claim. Albrecht v. First Federal Savings and Loan Ass'n, 372 N.W.2d 893, 894 (N.D.1985). However, a complaint should not be dismissed unless it appears beyond doubt that the plaintiff can prove no set of facts in support of his claim which would entitle him to relief. Johnson & Maxwell Ltd., v. Lind, 288 N.W.2d 763, 765 (N.D.1980).
The allegations in Patten's complaint stem from the parties' earlier divorce action. We take judicial notice of the record in the divorce action and the opinions issued in related cases that were appealed to this Court. See In re Estates of Kjorvestad, 304 N.W.2d 83, 86 (N.D.1981).
The record reveals that a divorce action was instigated by Valery in the district court of the South Central Judicial District on May 21, 1982. Patten v. Patten, No. 32400, mem. op. (South Central Judicial District, August 16, 1982). Custody of the parties' two children was initially placed with Gary, but problems with visitation resulted in a change of custody to Valery and restricted visitation by Gary. Gary was ordered to pay temporary spousal and child support, which he failed to do, and to submit to a mental evaluation and alcohol or drug abuse evaluation.
On October 24, 1982 Gary absconded with the children and dropped from sight until they were discovered in Juarez, Mexico, in February 1983. He was convicted of removing a child from the state in violation of a custody decree, a class C felony, and sentenced to prison. See State v. Patten, 353 N.W.2d 30 (N.D.1984). Additionally, when Gary fled to Mexico he took anything of value that he could carry with him, including two vehicles, and other items of value were either sold or given away. Patten v. Patten, No. 32400, mem. op. (South Central Judicial District, March 14, 1983). See also State v. Patten, 353 N.W.2d 26 (N.D.1984) (Gary's appeal from his conviction of defrauding a secured creditor by selling livestock while the divorce was pending and refusing to apply the proceeds to a loan). The remaining property, which was of little value, damaged, or subject to liens in excess of its value was awarded to Valery, including the garage and the barn referred to in Gary's complaint. Gary was ordered to pay all of the debts incurred by the parties, with two immaterial exceptions. Patten v. Patten, No. 32400, judgment (South Central Judicial District, May 16, 1983).
Gary now comes into court and asks for relief from his former wife in what appears to be an equitable action for an accounting. See, e.g., DiTerlizzi v. DiTerlizzi, 92 A.D.2d 604, 459 N.Y.S.2d 797 (1983), where the court held that a former husband was entitled to an equitable accounting to determine whether his former wife had paid certain costs and charges in accordance with a written agreement in a stipulation of settlement to pay these costs and charges.
Gary does not allege an agreement between the parties which would have obligated Valery to use the disputed funds for anything other than her personal support. Without an assertion of an underlying obligation on Valery's part to render an account to Gary, the complaint is deficient *460 and fails to state a claim upon which relief can be granted.
Of equal import, Gary's purported claim for relief is barred by the long-standing doctrine of "clean hands." He who seeks equity must do equity. Gajewski v. Bratcher, 221 N.W.2d 614 (N.D.1974); Cross v. Farmers' Elevator Co., 31 N.D. 116, 153 N.W. 279 (1915). Gary does not come into court with clean hands with regard to the events that occurred during the parties' divorce action. He is not entitled, therefore, to any relief from his former wife for events that occurred during the divorce proceedings.
The order of the district court is affirmed.
ERICKSTAD, C.J., and VANDE WALLE, GIERKE and MESCHKE, JJ., concur.
