Fix Excel VBA Error 3265 When Writing to an Access Recordset
Question details
Identify and correct the field reference causing error 3265 during an Excel-to-Access export.

- Product
- Microsoft Excel VBA and Microsoft Access through ADO
- Device & OS
- not provided
- Scenario
- A VBA macro exports worksheet data to an Access table using an ADO recordset.
- Observed behavior
- The macro raises error 3265, item cannot be found in the collection, when a worksheet value used to identify a recordset field does not match an available field name.
Open the VBA editor with Alt+F11 and locate the recordset assignment in the export macro. Check which worksheet row contains the Access field names and confirm that the recordset has been opened.
Use the correct worksheet row for Access field names
Use this fix when the recordset assignment reads a value from the wrong worksheet row instead of an Access field name.
The expression inside rst(...) must identify a field in the open recordset. A worksheet value intended as data cannot identify a field unless it also happens to match that field's name.
In the VBA editor, find the assignment such as rst(Cells(1, i).Value) = Cells(x, i).Value. Check the value in row 1 of the current column and determine whether it is an Access field name or data.
If row 3 contains the Access field names, change the assignment to rst(Cells(3, i).Value) = Cells(x, i).Value. Keep x as the data row and i as the column index used by your loop.
To avoid using the active sheet by mistake, assign the intended worksheet to a variable such as ws, then use rst(ws.Cells(3, i).Value) = ws.Cells(x, i).Value.
Compare each header in the referenced row with the fields available in the open recordset, correcting spelling or extra spaces. Run the macro again from the VBA editor.

Work with Excel spreadsheets in WPS Office
WPS Office is a free, lightweight alternative for working with spreadsheet files in a familiar interface. Its Excel format compatibility makes it easy to move everyday workbook tasks to WPS; fixing this Excel VBA and Access ADO error still requires checking the original macro and recordset.

Frequently Asked Questions
What does VBA error 3265 mean in this export?
It means the requested item was not found in a collection. In this case, the value passed to rst(...) may not match a field in the open ADO recordset.
Why does the macro appear to fail at Next i?
The loop may advance to a column whose header does not match a recordset field. In the VBA editor, step through the loop and inspect ws.Cells(3, i).Value and i for each iteration.
How can I check the fields available in the recordset?
In the VBA editor, inspect rst.Fields while debugging, or loop through rst.Fields and print each field's Name to the Immediate window with Debug.Print. Compare those names with the worksheet headers.
Why should I qualify Cells with a worksheet?
In Excel VBA, an unqualified Cells reference can point to the active sheet rather than the intended export sheet. Set a worksheet variable and use ws.Cells(row, column) for both the field name and data value.




