Runtime error 3265, Item cannot be found in the
collection corresponding to the requested name or ordinal.
This problem does not occur in Microsoft Data Access Components (MDAC) version 2.1.
Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.
View products that this article applies to.
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim fld As String
Set cn = New ADODB.Connection
cn.Open "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=Northwind;User ID=<UID>;Password=<strong password>;"
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM Products", cn, adOpenForwardOnly, adLockReadOnly, adCmdText
On Error GoTo errRs
fld = "ProductID"
Debug.Print rs.Fields(fld).Value
fld = "productid"
Debug.Print rs.Fields(fld).Value
On Error GoTo 0
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
Exit Sub
errRs:
Debug.Print "Field name comparison failure on: " & fld
Keywords: KB279651, kbprb, kbdatabase