Question

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

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top