
577 S.W.2d 522 (1979)
Kenneth SMITH, Appellant,
v.
Kenneth WILKINS, d/b/a Wilkins Investment Company, Appellee.
No. 8604.
Court of Civil Appeals of Texas, Texarkana.
January 23, 1979.
Rehearing Denied February 27, 1979.
*523 C. Mike Blalack, Mitchell & Blalack, Dallas, for appellant.
Neil A. Bickley, Touchstone, Bernays & Johnston, Dallas, R. Brent Cooper, Cowles, Sorrels, Patterson & Thompson, Dallas, for appellee.
CORNELIUS, Chief Justice.
Kenneth Smith has appealed from a judgment rendered against him as a sanction for *524 failure to answer interrogatories propounded pursuant to Tex.R.Civ.P. 168.
The suit was filed by Kenneth Wilkins against Smith, Worldco International and Kurt Zeisel for damages arising from a breach of contract. On March 4, 1977, Worldco and Smith, who was Worldco's president, filed a joint answer to the suit through their common attorney. On April 29 the attorney was allowed to withdraw, and apparently Smith and Worldco were thereafter temporarily without counsel or were represented by different counsel. On May 3 Wilkins served a set of interrogatories on Worldco, and on May 18 he served a separate set of interrogatories on Smith. Neither Worldco nor Smith answered the interrogatories within the 30 days allowed for answers. On June 10 Wilkins filed a motion asking the district court to compel Worldco to answer the interrogatories, and on June 23 he filed a motion to compel Smith's answers. A hearing on the motion regarding Worldco was set for June 29, and a hearing on the motion regarding Smith was set for July 8. The hearing set for July 8 was not held, but on June 29 the district court entered an order compelling both Worldco and Smith to answer their respective interrogatories by July 9. On July 11, the answers not having been filed, Wilkins applied for an order imposing sanctions, and on the same day the district court granted the motion by rendering an interlocutory default[1] judgment against both Worldco and Smith. Four days after entry of the judgment, Smith filed a set of answers to his interrogatories. On August 24 the case against the other defendant, Zeisel, was disposed of and the judgment against Worldco and Smith was made final.
Smith contends, among other things, that the judgment rendered against him was improper because he was denied an opportunity to be heard on the order, the violation of which formed the basis of the judgment. We agree. Penalties for failure to obey the discovery rules may be imposed only where all parties have been given notice of the motion to compel production, and have had an opportunity to be heard thereon. Sears, Roebuck & Company v. Hollingsworth, 156 Tex. 176, 293 S.W.2d 639 (1956).[2] Smith was given notice of the filing of the motion to compel, but he was not afforded an opportunity to be heard prior to the entry of the order.
It might be argued that Smith, being president of Worldco, was aware of the June 29 hearing on the motion to compel Worldco's answers, and that he could have availed himself of the opportunity at that time to be heard on the motion concerning his answers. Such an argument might have some merit if no separate hearing had been set for a consideration of the motion against Smith. But as such a separate hearing was set for July 8 and was pending, Smith had a right to rely upon that setting for an opportunity to be heard on the motion. The denial of that opportunity rendered the imposition of sanctions improper. Sears, Roebuck & Company v. Hollingsworth, supra.
In addition, as noted earlier, only four days after the entry of the interlocutory judgment and more than a month before that judgment was made final, Smith filed his answers to the interrogatories. The main object of sanctions is not to punish an erring party but to secure compliance with the discovery rules. Young Companies, Inc. v. Bayou Corp., 545 S.W.2d 901 (Tex.Civ.App. Beaumont 1977, no writ); Ebeling v. Gawlik, 487 S.W.2d 187 (Tex.Civ.App. Houston-1st Dist. 1972, no writ). It affirmatively appears that Wilkins would have suffered no injury had the interlocutory judgment been set aside. In those circumstances, *525 the court should have granted the motion for new trial. Compare Gordon v. Williams, 164 S.W.2d 867 (Tex.Civ.App. Beaumont 1942, no writ); Young Companies, Inc. v. Bayou Corp., supra.
Wilkins urges that Smith has waived his right to complain because he failed to set forth his complaint in his motion for new trial. Rule 325, which was repealed effective January 1, 1978, was in effect at the time the judgment in question here was rendered, and it provided that:
"In cases of motions for continuance, or for change of venue, or other preliminary motions made and filed in the progress of the cause, the rulings of the court thereon shall be considered as acquiesced in, unless complained of in the motion for new trial; .... Nothing in Rule 324 shall render a motion for new trial unnecessary in the instances mentioned in this Rule nor in instances of newly discovered evidence, misconduct, fraud or the like."
In his motion for new trial, Smith did not assign as error the action of the court in entering the order compelling answers. Nevertheless, the gist of his complaints on appeal, in points of error 6 and 7, is that the court erred in rendering judgment against him because he was denied an opportunity to be heard on the underlying order which resulted in the entry of that judgment. Such a complaint is not one complaining of the "ruling of the court" on a preliminary motion, as contemplated by the former Rule 325, and Smith is not precluded from urging it here because of his failure to assign it as error in his motion for new trial. See Young Companies, Inc. v. Bayou Corp., supra; Ebeling v. Gawlik, supra; Williams v. Whitten, 451 S.W.2d 535 (Tex.Civ.App. Tyler 1970, no writ); and City of Roma v. Starr County, 428 S.W.2d 851 (Tex.Civ.App. San Antonio 1968, writ ref'd n. r. e.).
It is not necessary that we consider the other points of error. The judgment is reversed and the cause is remanded to the district court.
NOTES
[1]  The judgment, strictly speaking was not a default judgment because Smith had an answer on file. See Hall v. C-F Emp. Credit U., 536 S.W.2d 266 (Tex.Civ.App. Texarkana 1976, no writ). It was a punitive judgment authorized by Tex.R.Civ.P. 168 and 215a. The judgment was interlocutory at this stage of the proceeding because the cause of action against Zeisel had not been disposed of or severed.
[2]  The same ruling applies to sanctions imposed under Fed.R.Civ.P. 33 and 37, after which the Texas rules were patterned. See Edgar v. Slaughter, 548 F.2d 770 (8th Cir. 1977).
