MS Access: ChDir Statement
This MSAccess tutorial explains how to use the Access ChDir function with syntax and examples.
Description
The Microsoft Access ChDir statement allows you to change the current directory or folder.
Syntax
The syntax for the ChDir statement in MS Access is:
ChDir path
Parameters or Arguments
- path
- The path that you'd like to set the current directory to.
Returns
The ChDir statement does not return a value, but rather changes the current directory or folder on the current drive.
Note
- If you need to change drives, try using the ChDrive statement first.
Applies To
The ChDir statement can be used in the following versions of Microsoft Access:
- Access 2019, Access 2016, Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000
Example
Let's look at how to use the ChDir function in MS Access:
ChDir "C:\instructions" Result: Sets the current directory to C:\instructions ChDir "C:\Documents\Supplies" Result: Sets the current directory to C:\Documents\Supplies
Example in VBA Code
The ChDir statement can be used in VBA code in Microsoft Access.
For example:
ChDir "C:\instructions"
In this example, the current directory would now be changed to C:\instructions.
Advertisements