Before or during the trial for an offense or attempted offense under this article, the judge of the court in which the case is pending, with the consent of the accused first obtained in open court, by an order of record, may direct that the deposition of the complaining witness be taken at a time and place designated in the order, and the judge may adjourn the taking thereof to such other time and places as he may deem necessary. Such deposition shall be taken before a judge of a circuit court in the county or city in which the offense was committed or the trial is had, and the judge shall rule upon all questions of evidence, and otherwise control the taking of the same as though it were taken in open court. At the taking of such deposition the attorney for the Commonwealth, as well as the accused and his attorneys, shall be present and they shall have the same rights in regard to the examination of such witness as if he or she were testifying in open court. No other person shall be present unless expressly permitted by the judge. Such deposition shall be read to the jury at the time such witness might have testified if such deposition had not been taken, and shall be considered by them, and shall have the same force and effect as though such testimony had been given orally in court. The judge may, in like manner, direct other depositions of the complaining witness, in rebuttal or otherwise, which shall be taken and read in the manner and under the conditions herein prescribed as to the first deposition. The cost of taking such depositions shall be paid by the Commonwealth.
Va. Code § 18.2-67