Home Privacy Policy Feedback Link to us Site Map

Access: ChDrive Statement


In Access, the ChDrive statement allows you to change the current drive.

The syntax for the ChDrive function is:

ChDrive drive

drive is the drive that you wish to change to.


Note:

The ChDrive lets you change the drive. If you need to change the current directory as well, try using the ChDir statement.


For example:

ChDrive "S" would set the current drive to S
ChDrive "C" would set the current drive to C

VBA Code

The ChDrive statement can be used in VBA code. For example:

ChDrive "S"
ChDir "S:\Games"

In this example, the current drive is set to the S drive. Then the current directory is set to S:\Games.