
235 Kan. 52 (1984)
679 P.2d 174
STATE OF KANSAS, Appellee,
v.
RODNEY FOSNIGHT, Appellant.
No. 55,258
Supreme Court of Kansas.
Opinion filed March 24, 1984.
Rawley J. Dent, of Independence, argued the cause and was on the brief for appellant.
Jeffrey A. Chubb, county attorney, argued the cause, and Robert T. Stephan, attorney general, was with him on the brief for appellee.
The opinion of the court was delivered by
MILLER, J.:
This is an appeal by Rodney Fosnight from his *53 conviction of aggravated robbery, K.S.A. 21-3427, resulting from his jury trial in Montgomery District Court. Three issues are presented: Whether the evidence was sufficient to sustain the trial court's denial of defendant's motion for judgment of acquittal and to sustain the conviction; whether defendant's absence from a hearing in chambers, when his counsel asked leave to withdraw, constituted reversible error; and whether the sentence imposed pursuant to the habitual criminal statute, K.S.A. 1983 Supp. 21-4504, should be set aside based upon prejudice inflicted upon the defendant at the in-chambers hearing.
The guidelines applicable to consideration of the first issue have been repeatedly stated. A trial judge, in passing on a motion for judgment of acquittal, must determine whether upon the evidence  giving full play to the right of the jury to determine credibility, weigh the evidence and draw justifiable inferences of fact therefrom  a reasonable mind or a rational trier of facts might fairly conclude guilt beyond a reasonable doubt. State v. Hutton, 232 Kan. 545, 550, 657 P.2d 567 (1983), quoting State v. Williams, 229 Kan. 290, 296, 623 P.2d 1334, reh. denied 229 Kan. 646, 630 P.2d 694 (1981). On appellate review, the question presented is whether all of the evidence adduced at the trial, when viewed in the light most favorable to the prosecution, convinces the appellate court that a rational factfinder could have found the accused guilty beyond a reasonable doubt. State v. Pham, 234 Kan. 649, 675 P.2d 848 (1984); State v. Voiles, 226 Kan. 469, 601 P.2d 1121 (1979); Jackson v. Virginia, 443 U.S. 307, 61 L.Ed.2d 560, 99 S.Ct. 2781, reh. denied 444 U.S. 890 (1979). Appellate courts look only to the evidence in favor of the verdict; they do not weigh the evidence; and if the essential elements are sustained by any competent evidence, the conviction stands. State v. Pham, 234 Kan. 649.
The defendant was charged and convicted of the July 20, 1981, aggravated robbery of Jim Riedle in Montgomery County, Kansas. The essential elements of that offense, pursuant to K.S.A. 21-3427 and under the third amended information filed in this case, are:
(1) that the defendant intentionally took property from the person or presence of Jim Riedle;
(2) that the taking was by force or threat of force;
(3) that the defendant was armed with a deadly weapon; and

*54 (4) that the act occurred on or about July 20, 1981, in Montgomery County, Kansas.
Jim Riedle, an assistant manger of a Quik Trip store in Independence, Kansas, identified the defendant as the man who robbed him. He testified in substance that a young man wearing a yellow raincoat or rain jacket and carrying a .22 caliber rifle entered the store, pointed the gun at Riedle, and ordered him to get a paper bag and put money in it. Riedle complied and the man left the store taking with him the gun and the bag containing about $600. Smith, an accomplice, testified that Fosnight committed the robbery and that the two fled on foot. A yellow raincoat and a .22 caliber rifle were found outside a home in the vicinity of the Quik Trip store. Another witness testified that both Smith and Fosnight acted suspiciously later that same evening, and that they "slouched down in the back seat like they didn't want to be seen" when they rode past the Quik Trip store in the back seat of the witness's car. Defendant, in his brief, bases his argument on the lack of credibility of Riedle and Smith. Though Smith's testimony differed from earlier statements, and though there were some conflicts in Riedle's testimony, we cannot weigh the evidence; the issue of the weight of the evidence was properly left to the jury. We conclude that there was substantial competent evidence to support the verdict, that the trial court correctly denied defendant's motion for judgment of acquittal, and that the evidence is sufficient to convince an appellate court that a rational factfinder could have found the defendant guilty beyond a reasonable doubt.
We turn now to the second issue. After all of the defense witnesses except the defendant had testified, defense counsel asked for a recess to chambers for the purpose of taking up motions. The jury trial was recessed, and the judge, counsel, the defendant and the codefendant retired to chambers. Counsel for Fosnight asked that the matter be taken up with just counsel present, and he waived the defendant's right to be present. Fosnight and his codefendant were excused by the judge, and both defendants left the judge's chambers. Fosnight's counsel then said:
"Very simply, I'm caught in a classic awkward professional situation where there are things that I know that come to me through attorney-client privilege, and what can I say, except that on that basis without disclosing any more to the Court. I respectfully move to withdraw."
*55 Counsel for the State then speculated at length as to the reason for the motion, concluding that defense counsel must be aware that the defendant intended to perjure himself, and that the defense counsel cannot, under the code of ethics, be a party to such action. The trial judge denied the motion to withdraw, commenting that counsel had done an excellent job, and suggesting that counsel advise the defendant as to the penalties for perjury and the possibility that it might be a third felony conviction if the defendant committed perjury and were prosecuted and convicted of that offense. The trial then resumed. The defendant was sworn and took the witness stand. His attorney asked: "Mr. Fosnight, is it your desire to tell the court some things today?" Defendant responded affirmatively, and counsel said: "Okay, go ahead." Without further questioning by his attorney, defendant then proceeded to tell his story.
The Code of Professional Responsibility, as adopted by the House of Delegates of the American Bar Association, has been adopted by this court and governs the conduct of attorneys within this state. See 232 Kan. clxxv et seq. Canon 4, entitled A Lawyer Should Preserve the Confidences and Secrets of a Client, provides in applicable part:
"DR 4-101 ....
"(B) Except when permitted under DR 4-101(C), a lawyer shall not knowingly:
"(1) Reveal a confidence or secret of his client.
....
"(C) A lawyer may reveal:
....
"(3) The intention of his client to commit a crime and the information necessary to prevent the crime."
Canon 7, entitled A Lawyer Should Represent a Client Zealously Within the Bounds of the Law, provides in part:
"DR 7-102 Representing a Client Within the Bounds of the Law.

"(A) In his representation of a client, a lawyer shall not:
....
"(4) Knowingly use perjured testimony or false evidence.
....
"(6) Participate in the creation or preservation of evidence when he knows or it is obvious that the evidence is false.
"(7) Counsel or assist his client in conduct that the lawyer knows to be illegal or fraudulent."
The Standards Relating to the Defense Function, adopted by the American Bar Association, Approved Draft, 1971, discusses *56 the situation with which trial counsel was faced in this case. The pertinent standard reads:
"7.7 Testimony by the defendant.
"(a) If the defendant has admitted to his lawyer facts which establish guilt and the lawyer's independent investigation establishes that the admissions are true but the defendant insists on his right to trial, the lawyer must advise his client against taking the witness stand to testify falsely.
"(b) If, before trial, the defendant insists that he will take the stand to testify falsely, the lawyer must withdraw from the case, if that is feasible, seeking leave of the court if necessary.
"(c) If withdrawal from the case is not feasible or is not permitted by the court, or if the situation arises during the trial and the defendant insists upon testifying falsely in his own behalf, it is unprofessional conduct for the lawyer to lend his aid to the perjury or use the perjured testimony. Before the defendant takes the stand in these circumstances, the lawyer should make a record of the fact that the defendant is taking the stand against the advice of counsel in some appropriate manner without revealing the fact to the court. The lawyer must confine his examination to identifying the witness as the defendant and permitting him to make his statement to the trier or the triers of the facts; the lawyer may not engage in direct examination of the defendant as a witness in the conventional manner and may not later argue the defendant's known false version of facts to the jury as worthy of belief and he may not recite or rely upon the false testimony in his closing argument."
For cases where this situation has arisen, see Annotation, Rights and Duties of Attorney in a Criminal Prosecution Where Client Informs Him of Intention to Present Perjured Testimony, 64 A.L.R.3d 385 et seq.
This problem has previously been before this court. In State v. Henderson, 205 Kan. 231, 468 P.2d 136 (1970), the accused informed his counsel of a new version of the events at issue four days before trial was scheduled to commence. Believing the concocted story to be false, the attorney informed his client that he would not be a party to perjury. The accused replied that he was willing to run the risk of perjury and insisted that the trial proceed on the basis of the new version. Counsel promptly informed the trial judge of his client's avowed intention to commit perjury and of his demand that counsel assist him in the unethical conduct, but the attorney divulged no confidential attorney-client communications. Counsel asked leave to withdraw. The trial court denied the motion. Trial proceeded; defendant did not testify. Following his conviction defendant appealed, contending as his principal complaint that the trial court erred in refusing his attorney's motion to withdraw. Justice O'Connor, speaking for a unanimous court, said:

*57 "Looking first at the propriety of Mr. Anderson's actions after he learned of the defendant's `new' version of the facts and his insistence upon the defense being conducted along that line, we are of the opinion Anderson acted according to the moral and ethical obligations required of him as a member of the legal profession.
"The law requires honest, loyal, genuine, and faithful representation of a defendant by his attorney, whether employed or court-appointed. (State v. Brown, 204 Kan. 430, 464 P.2d 161; State v. Calhoun, 194 Kan. 378, 399 P.2d 886.) A lawyer's professional duty requires him to be honest with the court and to conform his conduct to recognized legal ethics in protecting the interests of his client. Counsel, however, is never under a duty to perpetrate or aid in the perpetration of a crime or a dishonest act to free his client. Neither is he required to stultify himself by tendering evidence or making any statement which he knows to be false as a matter of fact in an attempt to obtain an acquittal at any cost. In conducting his task, counsel should be guided by the standard `all fair and honorable means,' as laid down by Canon 5 of the American Bar Association Canons of Professional Ethics (198 Kan. xvii), in discharging the duty imposed by that canon `to present every defense that the law of the land permits, to the end that no person may be deprived of life or liberty, but by due process of law.' For a few of the decisions speaking of these ethical considerations, see, Jackson v. United States, 258 F. Supp. 175, affirmed, 384 F.2d 375, cert. denied, 392 U.S. 932, 20 L.Ed.2d 1392, 88 S.Ct. 2298; Bowler v. Warden, Maryland Penitentiary, 236 F. Supp. 400; United States v. Von Der Heide, 169 F. Supp. 560; Williams v. Beto, 354 F.2d 698 (5th Cir., 1965); Wood v. United States, 357 F.2d 425 (10th Cir., 1966), cert. denied, 385 U.S. 866, 17 L.Ed.2d 94, 87 S.Ct. 129. Also, see, Canons, 15, 16, 22, 31, and 32.
"The high ethical standards demanded of counsel in no way mollify the fair, full and loyal representation to which an accused is entitled as a part of due process. They are entirely consistent with the objective of our legal system  to ascertain an accused's guilt or innocence in accordance with established rules of evidence and procedure designed to develop the facts truthfully and fairly. Counsel, of course, must protect the interests of his client and defend with all his skill and energy, but he must do so in an ethical manner.
"We perceive nothing violative of the confidentiality inherent in the attorney-client relation by Mr. Anderson's making known to the court defendant's avowed intention of presenting perjured testimony. While as a general rule counsel is not allowed to disclose information imparted to him by his client or acquired during their professional relation, unless authorized to do so by the client himself (State v. Leigh, 178 Kan. 549, 289 P.2d 774), the announced intention of a client to commit perjury, or any other crime, is not included within the confidences which an attorney is bound to respect. (Canon 37; also, see, K.S.A. 60-426[b][1].) Moreover, the record does not disclose the specific details of any communications between the defendant and his counsel were ever divulged by Anderson to the court or the prosecution. When Anderson learned that the defendant would not agree to the presentation of a defense consistent with the facts defendant initially related to him, and which were substantiated by Anderson's own independent investigation, he acted according to the dictates of his own conscience and his professional obligation to the court, and properly asked to be relieved from his assignment.

*58 "When the trial judge became informed of counsel's predicament, he was faced with a difficult decision calling for the exercise of sound judicial discretion. The right to counsel, which the court was obligated to safeguard for the accused's benefit, contemplates the guidance of a responsible, capable lawyer devoted to his client's interests. (Ray v. State, 202 Kan. 144, 446 P.2d 762.) As long as the trial court had a reasonable basis for believing that the attorney-client relation had not deteriorated to a point where appointed counsel could no longer give effective aid in the fair presentation of a defense, the court was justified in refusing to appoint new counsel.
"A careful study of the record convinces us that the situation confronting the court, and about which defendant now complains, was precipitated by the defendant himself. On the morning of trial when Anderson asked the court for permission to withdraw, he told the court he had previously asked the defendant to request that another attorney be appointed in his stead but defendant refused because he `desired the prejudicial error' remain for purposes of appeal. Defendant in no way denies his attorney's statement, as evidenced by the colloquy set forth above at the close of the state's evidence. Obviously, the defendant wished to dictate the conduct of his defense in a manner which the law does not countenance, and by complicating the situation, hoped to gain some advantage, both at trial and on appeal. One who by his own acts invites error is in no position to complain or take advantage of it on appeal. (State v. Cantrell, 201 Kan. 182, 440 P.2d 580, cert. denied, 393 U.S. 944, 21 L.Ed.2d 282, 89 S.Ct. 315.) Despite the fact that defendant then changed his stance and, according to Anderson, refused to cooperate and to divulge just what his testimony would be, Anderson, with commendable professional candor and patience, stated he was prepared to represent the defendant to the best of his legal ability.
"Defendant, by his devious methods, invited the only course of action available to the trial judge if the case was to be disposed of with any reasonable degree of dispatch. The effective and efficient administration of criminal justice requires that a trial court not yield to every whim and demand of a defendant. Had the court granted counsel's motion to withdraw, the same predicament could easily have been precipitated by defendant with respect to any new counsel that might have been appointed.
"The trial judge's confidence in Mr. Anderson's capability to remain in the case was well placed, in our view. In addition to presenting the motion in limine, Anderson thoroughly cross-examined the state's witnesses, particularly as to the identity of the person who committed the robbery. He made an opening statement for the defense and presented the testimony of an attorney present at the lineup with regard to the defendant's behavior and appearance, which, of course, was relevant to the question of identification. Further, defendant was fully informed by counsel, as well as the court, of his right to take the stand and `tell his story,' but defendant declined to do so.
"Success can never be deemed the measure of whether or not an accused has had the effective assistance of counsel. The representation accorded defendant was far more than token or perfunctory in nature, and there can be no question about its adequacy. (Baker v. State, 204 Kan. 607, 464 P.2d 212; State v. Brown, supra.)

*59 "Under all the facts and circumstances, we hold that the trial judge did not abuse his discretion to the prejudice of defendant's substantial rights by requiring Anderson to remain as counsel. (See, State v. Way, 204 Kan. 375, 461 P.2d 820; State v. Walker, 202 Kan. 475, 449 P.2d 515.)" 205 Kan. at 236-239.
The rules stated and applied in Henderson are equally applicable here.
Under the rules stated above, counsel for Fosnight took one of the courses available to him. He asked for leave to withdraw without disclosing to the trial court any confidential information disclosed to him by his client. When that motion was denied, counsel properly permitted his client to tell his story from the witness stand, without engaging in direct examination of the client as a witness in the conventional manner. He identified the witness as the defendant and then permitted him to tell his story to the jury without further questioning or encouragement. Counsel did not violate the Code of Professional Responsibility. The in-chambers conference added nothing to the proceedings here, and did not inform the trial judge of anything he would not have surmised at once had counsel simply put the defendant on the stand and permitted him to proceed to tell his story without encouragement or help from counsel.
Defendant cites K.S.A. 22-3405, which provides in part:
"The defendant in a felony case shall be present at the arraignment, at every stage of the trial including the impaneling of the jury and the return of the verdict, and at the imposition of sentence, except as otherwise provided by law." (Emphasis supplied.)
Defendant contends that he was prejudiced by not being present at the in-chambers conference because his counsel was not representing him at that hearing, and that he was sentenced more harshly as a result of that conference.
The matter of the withdrawal of counsel, upon being advised that his client intends to commit perjury, is a matter governed by ethical standards and is, therefore, a matter of law. We have frequently held that in-chambers conferences dealing with legal or procedural questions are not stages of the trial at which a defendant's presence is required in order to avoid prejudice. State v. Knapp, 234 Kan. 170, 671 P.2d 520 (1983) (in-chambers inquiry into juror's outside knowledge of the case); State v. Marks, 231 Kan. 645, 647 P.2d 1292 (1982) (in-chambers conference regarding exercise of peremptory challenges); State v. *60 Sanders, 227 Kan. 892, 610 P.2d 633 (1980) (in-chambers conference on questions of law presented in motions in limine); State v. Sandstrom, 225 Kan. 717, 595 P.2d 324, cert. denied 444 U.S. 942 (1979) (in-chambers hearings concerning motion for judgment of acquittal and juror misconduct, where defense counsel stated that defendant waived her right to be present); State v. Mantz, 222 Kan. 453, 565 P.2d 612 (1977) (in-chambers conference concerning jury instructions).
In Lowery v. Cardwell, 575 F.2d 727 (9th Cir.1978), defense counsel abruptly stopped questioning the defendant and requested a recess. In chambers, with the defendant absent, counsel made a motion to withdraw. He did not state any reason for the motion. The motion was denied, trial proceeded, defendant was convicted, and the defendant on appeal claimed error. The Ninth Circuit held that the lawyer's actions unequivocally informed the trial judge that the defendant was going to perjure herself, and thus the defendant was denied a fair trial. Lowery, however, differs materially from the case at hand since in that case trial was to the court, not to a jury. Here, the jury was not informed in any manner of the substance of the in-chambers conference, and we find that the defendant's right to a fair trial was not prejudiced.
The appellate court in Lowrey also held that "nothing occurred off the record during the chambers conference that rendered appellant's absence constitutionally improper. The subject of the off-the-record conference was purely procedural and appellant's presence was not required." 575 F.2d at 729. Similarly, defendant Fosnight was not prejudiced in the proceedings here.
The final issue is whether the sentence should be set aside. Contrary to defendant's contention, the record does not indicate that the trial judge determined to invoke the habitual criminal act at the time of the in-chambers conference. He merely reminded counsel what could occur if the defendant committed perjury and were later to be convicted of that offense, and he asked counsel to so advise his client. The State had already given notice that it intended to invoke the habitual criminal act, and the trial court could not do so on its own initiative. K.S.A. 1983 Supp. 21-4504. The sentence imposed seven months later was *61 within the statutory limits, and we find nothing in the record to indicate prejudice to the defendant in its imposition.
The judgment is affirmed.
