Fix Microsoft Access Run-Time Error 2302 When Exporting Query Results
Question details
The user needs to resolve Run-time error 2302 in Microsoft Access, which prevents query results from being exported and saved.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Exporting query results to a specified file or network location using the OutputTo procedure in Access VBA.
- Observed behavior
- An Error 2302 message appears, indicating that Access cannot save the output data to the specified location, often due to an incomplete file path or folder permission issues.
Before modifying your VBA code, verify that the target destination drive is accessible and that you have full read and write permissions for the designated export folder.
Specify a Complete File Path with the File Extension
Error 2302 frequently occurs when the OutputTo procedure is given a folder path instead of a full file path. Adding the specific file name and extension resolves the problem.
The DoCmd.OutputTo method requires the exact destination file name, not just the directory. Supplying only a folder name leaves Access unable to generate the file, triggering the error.
Press Alt + F11 in Microsoft Access to open the Visual Basic for Applications (VBA) editor.
Find the variable or string defining your export destination, such as strFullPathMatches.
Update the string to include the exact file name and the corresponding extension. For example, change 'I:\Folder\' to 'I:\Folder\CorrespondenceMatches.xlsx'.
Save your VBA project and trigger the export procedure again to verify that the file saves successfully.

Close Existing Files and Verify Network Availability
Access cannot overwrite a file if it is currently locked by another program or if the network drive has become disconnected.
Add an Error Handler for Troubleshooting
Implementing an error handler in your VBA code allows you to capture precise error descriptions, making it easier to diagnose the root cause.
Analyze Your Exported Query Results with WPS Office
After successfully exporting your database queries, you need a reliable spreadsheet tool to analyze the data. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Excel for opening, formatting, and charting your .xlsx files.
- 1. Download and Install WPS Office: Download WPS Office for free from the official website and complete the quick installation.
- 2. Open WPS Spreadsheet: Launch WPS Spreadsheet from the main dashboard.
- 3. Load Your Exported File: Click 'Open' and locate the .xlsx file you exported from Microsoft Access to instantly view and analyze your query results.

Frequently Asked Questions
Why does the OutputTo procedure trigger Error 2302?
This error generally occurs when the target output path is specified as a folder rather than a complete file path. It can also happen if the file is currently open and locked by another application, or if you lack write permissions for the destination folder.
How do I format the output path correctly in Access VBA?
Your path string must include the drive letter, folder hierarchy, file name, and the appropriate file extension. For example: "C:\Reports\DailyExport.xlsx".
Can a disconnected network drive cause Run-time error 2302?
Yes. If your VBA code tries to save an export to a mapped network drive that is offline or experiencing connection drops, Access will be unable to locate the path, resulting in Error 2302.
Does path length affect the OutputTo command in Access?
Yes, standard Windows file path length limits apply. If your folder structure plus the file name exceeds 256 characters, Access will fail to save the file and display an error. Try saving to a shorter path, such as C:\Exports\.




