Others

Fix Microsoft Access Run-Time Error 2302 When Exporting Query Results

Khadija KhanKhadija Khan Nov 10, 2026 869 views

Question details

The user needs to resolve Run-time error 2302 in Microsoft Access, which prevents query results from being exported and saved.

Fix Access Run-Time Error 2302 When Exporting Query Results
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 you start

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.

Solution 1Recommended

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.

1
Open the VBA Editor

Press Alt + F11 in Microsoft Access to open the Visual Basic for Applications (VBA) editor.

2
Locate the Output Path Variable

Find the variable or string defining your export destination, such as strFullPathMatches.

3
Append the File Name and Extension

Update the string to include the exact file name and the corresponding extension. For example, change 'I:\Folder\' to 'I:\Folder\CorrespondenceMatches.xlsx'.

4
Save and Run the Code

Save your VBA project and trigger the export procedure again to verify that the file saves successfully.

Specify a Complete File Path with the File Extension
Match Format Parameters: Ensure the file extension in your string matches the format parameter in your OutputTo command (e.g., use .xlsx for acFormatXLSX).
Free Microsoft Office alternative

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. 1. Download and Install WPS Office: Download WPS Office for free from the official website and complete the quick installation.
  2. 2. Open WPS Spreadsheet: Launch WPS Spreadsheet from the main dashboard.
  3. 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.
Fully compatible with Microsoft Excel formats (.xlsx, .xls, .csv).Free and lightweight office suite with advanced data analysis tools.Familiar tabbed interface makes migrating and navigating effortless.Seamlessly open data exports from databases without subscription fees.
microsoft office alternative - wps office

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\.