Appeals from orders of the Supreme Court at Special Term, entered January 31, 1980 in Fulton County, which denied plaintiffs’ motion pursuant to CPLR 3211 (subd [b]) to strike the defense of res judicata, and which, after granting plaintiffs’ motion for re-argument, adhered to its original decision. The determination of this appeal depends on the validity of the defense of res judicata arising out of the following real property transaction. On August 18, 1955, Mayer L. Cramer and Ida Cramer, the then owners of lots numbered 260, 261 and 262, located in the Town of Northampton, Fulton County, New York, conveyed Lot No. 260 and part of Lot No. 261 to the plaintiffs. In 1968, the Cramers conveyed the remainder of Lots Nos. 261 and 262 to the defendant Janet C. Hillelson, who, on July 28, .1972, conveyed a part of Lot No. 261 and a part of Lot No. 262 to the defendant Lawrence S. Hillelson. Shortly after the Hillelson conveyance, the plaintiffs discoveréd that the house they had built in 1956 encroached on the property described in the deed to Hillelson. The plaintiffs commenced an action on June 19, 1974 against the Cramers and the Hillel-sons. The complaint in that action alleged only a cause of action to reform their deed to correctly describe the premises the plaintiffs claimed were intended to be conveyed to them, to include the parcel on which they had built their house and which, they contended, had been omitted from their conveyance through the mutual mistake of the parties. At the close of the plaintiffs’ case in that prior action, Trial Term dismissed the complaint on the merits for the plaintiffs’ failure to prove a cause of action against the defendants named therein. The court also stated that the six-year Statute of Limitations governing reformation of instruments based on mistake (CPLR 213, subd 6) was an additional reason for dismissal as to the defendants Hillelson since they had pleaded the Statute of Limitations affirmatively, whereas the Cramers had not. Following this adverse decision, the plaintiffs commenced the present suit on January 29, 1979, pursuant to RPAPL article 15, to compel a determination that they were entitled to at least that portion of the disputed strip on which ■ they had built, by adverse possession. In answer, the defendants interposed affirmatively the defense of res judicata, claiming that the determination in the prior action was a complete bar. The plaintiffs moved at Special Term to strike this defense for insufficiency. The motion was denied by Special Term, which, upon granting the plaintiffs’ motion for reargument, adhered to its original decision. The plaintiffs attempt to appeal both orders. Procedurally, the appeal from the original order should be dismissed as academic and the review herein limited to the order adhering to the initial determination after reargument. This latter order supersedes the original one (Guterding v Guterding, 55 AD2d 614). We agree with Special Term’s denial of the plaintiffs’ motion. The doctrine of res *726judicata holds that a valid final judgment bars future actions between the same parties for the same cause. (See, e.g., 50 CJS, Judgments, § 598.) Inasmuch as the court in the prior action had jurisdiction of the subject matter and the parties to this action were also parties to the first, they are bound by that judgment if “the cause of action” in both suits is the same. Where an identity of the causes of action exists in both suits, the judgment in the former action is conclusive in the later, not only as to any matters actually litigated therein, but also as to any that might have been litigated, so that a different judgment in the second would not destroy or impair rights or interests established by the first. The prior judgment “is not conclusive, however, to the same extent when the two causes of action are different, not in form only * * *, but in the rights and interests affected. The estoppel is limited in such circumstances to the point actually determined” (Schuylkill Fuel Corp. v Nieberg Realty Corp., 250 NY 304, 307; see, also, Smith v Kirkpatrick, 305 NY 66). A subsequent cause of action does not differ from the first merely because it denotes one of the several separately stated claims arising out of the same foundation facts; or relates to different legal theories of recovery; or demands different legal relief. Rather, it is the gravamen of the wrong upon which the action is grounded that determines the identity of the causes (Matter of Reilly v Reid, 45 NY2d 24). Differences in legal theory will generally not permit relitigation of claims based on the same foundation facts (Matter of Gowan v Tully, 45 NY2d 32, 36). This interpretation is in accord with the policy basis of the doctrine that res judicata is designed to provide finality in the resolution of disputes to assure that parties may not be vexed by further litigation (see Matter of New York State Labor Relations Bd. v Holland Laundry, 294 NY 480, 493-494). As recently stated by the Court of Appeals, when the same foundation facts serve as the predicate for each proceeding, “ ‘the claim extinguished includes all rights of the plaintiff to remedies against the defendant with respect to all or any part of the transaction, or series of connected transactions, out of which the action arose’ ” (Matter of Reilly v Reid, supra, p 29, quoting Restatement of Judgments, Second [Tent Draft No. 1, 1973], § 61, subd [1]; see, also, Matter of Gowan v Tully, supra, p 36). Herein, both the reformation action and the adverse possession action arose from connected transactions, i.e., the conveyances of adjoining lots from the Cramers to these plaintiffs and these defendants. In the prior action, the plaintiffs sought to establish their entitlement to the disputed parcel by obtaining a corrected deed. In the present action they seek to establish their entitlement by adverse possession to that part of the same disputed parcel on which they had built their house. Thus, the plaintiffs’ objective in both actions is the same. The difference lies only in the legal theory on which their demand for relief is based. Accordingly, both causes of action are not separate and distinct so as to permit the subsequent suit. At the time the first action for reformation was commenced, the cause of action for adverse possession was also viable and could also have been pleaded in the prior complaint and determined in the prior action. True, the prior complaint did not specifically state a cause of action for adverse possession, but it could have. The two actions, therefore, possess a measure of identity such that a different judgment in the present action would impair the rights or interest of these defendants to the land in question established by *727the first. The two actions do not involve different “rights and wrongs’’ between the same parties (Smith v Kirkpatrick, supra). Therefore, the defense of res judicata is a complete bar to the present action and Special Term was correct in denying the plaintiffs’ motion to strike this defense (see McLearn v Cowen & Co., 48 NY2d 696). Having so determined, however, Special Term should have granted the defendants summary judgment dismissing the plaintiffs’ complaint pursuant to CPLR 3211 (subd [c]) even though the defendants had not cross-moved for such relief (Siegel, Practice Commentaries, McKinney’s Cons Laws of NY, Book 7B, CPLR 3211:40, p 43; see Wiseman v Knaus, 24 AD2d 869). Since the parties submitted evidentiary material in the form of affidavits and documents on both the original motion and the reargument motion, and had a full and fair opportunity to argue the merits of the controlling question of law, the purpose of the notice requirement of CPLR 3211 (subd [c]) has been served, and summary judgment is appropriate since no questions of fact exist (cf. O’Hara v Del Bello, 47 NY2d 363, 367-368). The order of Special Term granting reargument and adhering to its original decision should be modified by granting summary judgment to the defendants dismissing the plaintiffs’ complaint on the merits, and, as so modified, affirmed. Order granting reargument and adhering to original decision modified, on the law, by granting defendants summary judgment dismissing plaintiffs’ complaint on the merits, and, so modified, affirmed, with costs to defendants. Appeal from order denying plaintiffs’ motion to dismiss the defense of res judicata dismissed, without costs. Sweeney, J. P., Kane, Main and Casey, JJ., concur.
Herlihy, J., concurs in part and dissents in part in the following memorandum.
Herlihy, J. (concurring in part and dissenting in part).
I concur in the affirmance of the order of Special Term granting reargument and with the dismissal of the appeal from the order denying plaintiffs’ motion to dismiss the defense of res judicata. The critical points in this case appear to be the alleged facts that: (1) plaintiffs purchased land from the Cramers on August 18, 1955; (2) plaintiffs entered into possession of a strip of land still owned by the Cramers in 1956; (3) in 1968 Cramers conveyed the strip of land possessed by plaintiffs to defendant, Janet C. Hillelson; (4) on July 28, 1972 Janet Hillelson conveyed the strip to Lawrence S. Hillelson; (5) on June 19, 1974 plaintiffs commenced an action against the Cramers and the Hillelsons upon the theory that in fact the original purchase on August 18, 1955 did include the disputed strip of land and sought reformation of their 1955 deed to reflect such fact; (6) the 1974 action went to trial on April 5, 1976 and the court dismissed the complaint at the close of plaintiffs’ case on the merits; (7) the present action was commenced on January 29, 1979 seeking to establish title by adverse possession. To the extent that any adverse possession could have been claimed against the Cramers and by tacking against the defendants herein, it is apparent that the applicable statutory period of 15 years would have expired in 1970 or 1971, well before the conclusion of the prior proceeding. As to any proof of title in plaintiffs based upon a possession adverse to the Cramers, the prior judgment would be conclusive since the gravamen of the action is the same. Accordingly, Special Term properly determined that the defense of res judicata would be valid and conclusive as to the present complaint which specifically pleads that the adverse occupation commenced in 1955. Of course, the *728prior action was premised upon a possession authorized by the Cramers and with the Cramers’ consent. As to the Hillelsons, the reason for the action against them in 1974 was to subject them to the plaintiffs’ title as owners of the premises upon the theory that they had knowledge of such title and were not bona fide purchasers. The possession not necessarily being adverse as to the Cramers in 1955 or 1956 or prior to the conveyance to Janet Hillelson in 1968, it is apparent that plaintiffs could not establish adverse title against the world or the Hillelsons except on acts as of 1968 or later. (Cf. Reiter v Landon Homes, 31 AD2d 538, mot for lv to app den 24 NY2d 738, where the 10-year period had not expired during the defendants’ legal ownership.) Commencing with the 1968 purchase by Janet Hillelson the plaintiffs hold adversely and openly and notoriously at least as to the portion of the premises where the house was located. That the possession was under erroneous claim of title is of no consequence as to the Hillelsons. At the commencement of the 1974 action, and at the time of its decision, the period of limitation effective in 1968 (10 years) had not yet expired and so there could be no claim of adverse possession against them based upon the Hillelsons’ ownership of the land and the plaintiffs’ possession as to them. The plaintiffs’ complaint in this action relies entirely upon the commencement of an adverse possession in 1955 and the then applicable period of limitation of 15 years. However, the complaint may be amended or proof adduced at trial as to a 10-year period solely against the Hillelsons and the complaint conformed to the proof. (Cf. Reiter v Landon Homes, supra.) Further, the allowance of subsequent actions based upon adverse possession is not substantially different than actions based upon' continuing trespass. The subsequent action herein does not undermine the prior judgment inasmuch as a new period of time can be placed in issue. Based upon the foregoing, the modification of the order of Special Term to dismiss the complaint is premature and erroneous as a matter of law. The order granting reargument should be affirmed without modification.