1
votes

I'm trying to bind a continuous form to an ADO Recordset using "Microsoft ActiveX Data Objects 2.8 Library". I'm getting the following error when I try to bind the recordset to my form:

3265 Item cannot be found in the collection
corresponding to the requested name or ordinal.

And here's my code:

Dim cn As New ADODB.Connection, rs As New ADODB.Recordset
cn.ConnectionString = "Driver={MySQL ODBC 5.2 ANSI Driver};" & _
    "Server=redacted;Database=redacted;" & _
    "User=redacted;Password=redacted;"
cn.Open
rs.Open "SELECT * FROM device", cn, adOpenStatic, adLockReadOnly
'I can debug.print records and fields right here
Set Me.Recordset = rs 'Error happens here
cn.Close
Set cn = Nothing

I'm using Office 2013 32bit on Windows 8.1 64bit with the MySQL 32bit ODBC driver (the 64bit driver cannot be called from a 32bit application).

1
Just for grins, try making your 'rs' as a 'Dim' of it's own. I just ran my version of your code without a problem (except I have Office 2010, SQL Server 2012, Vista, so used {SQL Server} as my driver). Years ago I saw random issues with Dim's combined if different types. And gotta ask: is your code in the Form_Load event? - Wayne G. Dunn
Yes the code is in form load. And actually, in the code I've been running the Dims are on separate lines. I shortened it up to post here. I also run lots of ADO on Access 2010 in Windows 7 without any problems. I'm not yet a fan of Access 2013. - HK1
Can you try on a different workstation and / or modify your connection string to use a different driver? I found a link mentioning "misconfigured system files", which sounds like a possibility, but never have trusted their 'download solution': wiki-errors.com/err.php?wiki=3265 - Wayne G. Dunn

1 Answers

3
votes

Well, the problem persisted on Access 2010/Win7. But I fixed it by specifying the cursor location before running the Open method:

rs.CursorLocation = adUseClient
rs.Open "SELECT * FROM device", cn, adOpenStatic, adLockReadOnly