How to Set Access FileDialog to Open in Current Project Folder
Question details
The user needs the Microsoft Access FileDialog to automatically open in the folder where the current database file resides, ensuring the path dynamically updates if the database is moved to a new location.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Configuring a file picker dialog in an Access VBA application to default to the database's current directory.
- Observed behavior
- Because the application is movable, hardcoded paths fail. The developer requires a dynamic reference using CurrentProject.Path, which itself is read-only.
Open your Microsoft Access database, ensure you have enabled macros, and confirm you have access to the VBA Editor (ALT + F11) to write or modify the FileDialog code.
Set the InitialFileName Property to CurrentProject.Path
Use the InitialFileName property of the FileDialog object combined with CurrentProject.Path to dynamically set the starting directory.
By using the InitialFileName property, you direct the file picker to open in a specific location. Combining this with CurrentProject.Path ensures the dialog always opens where the database file is currently located, making your application completely portable.
Press the ALT + F11 keys on your keyboard to open the Visual Basic for Applications (VBA) Editor in Access.
In your VBA module, declare your FileDialog variable and assign it using Application.FileDialog(msoFileDialogFilePicker).
Add the code '.InitialFileName = CurrentProject.Path & "\\"' to set the default folder. If you need a specific subfolder like Images, use '.InitialFileName = CurrentProject.Path & "\\Images\\"'.
Use the '.Show' method to display the file picker box to the user and retrieve the selected file path.

Manage Moved Databases with a Configuration Table
If your movable Access application relies on linked tables, use a configuration table to detect path changes on startup.
Looking for a Lightweight, Reliable Office Suite?
While Microsoft Access manages complex relational databases using VBA, many data organization and analysis tasks can be handled more efficiently with advanced spreadsheets. WPS Office is a highly compatible, free alternative to Microsoft Office that offers powerful data management tools without the heavy overhead.
- 1. Download WPS Office: Visit the official WPS website and download the free WPS Office installation package.
- 2. Install the Software: Run the downloaded installer and follow the simple on-screen instructions to set up WPS Office on your computer.
- 3. Open Your Data Files: Launch WPS Spreadsheet and seamlessly open your existing .xlsx or .csv data exports to start managing your information.

Frequently Asked Questions
Can I use the Filters property to change the Access FileDialog starting folder?
No, the Filters property is strictly used to specify the types of files (such as .txt or .accdb) that appear in the dialog dropdown. You must use the InitialFileName property to define the default starting path.
Why can't I change the CurrentProject.Path value in VBA?
CurrentProject.Path is a read-only property in Microsoft Access. It simply reads and returns the physical file path of the currently open database on your operating system, so it cannot be manually overwritten via code.
How do I open a specific subfolder relative to the current project?
You can easily target a subfolder by appending its name to the CurrentProject.Path property using string concatenation. For example, using '.InitialFileName = CurrentProject.Path & "\\MySubfolder\\"' will automatically open the 'MySubfolder' directory located inside your main database folder.




