In Access, the CurDir function returns a string containing the full path of the specified drive.
The syntax for the CurDir function is:
CurDir ( drive )
The optional drive argument is a string expression that specifies an existing drive. If this parameter is omitted or it is a zero-length string (“”), CurDir returns the path for the current drive.
Example
|
VBA Code
|
This example uses the CurDir function to return the current path. Now the MyPath variable would contain the value “C:\Documents and Settings\UserName\My Documents”.
SQL query
You can also use the CurDir function in a query.
|
Note
This function cannot be used or referenced in expressions when Access is operating in sandbox mode, but they can be used in Microsoft Visual Basic for Applications (VBA) code. To enable the CurDir function in expressions or SQL statements, add the following code to a code module in the Visual Basic Editor in Access:
|