I started getting this problem recently. Don't know how it started but I know I disabled some windows services that startup, and deleted some odbc, probably a mysql odbc data source but I'm using MS SQL 2000 for the following.
I get the error when trying to populate the recordset, and the error details are: "Run-time error '-2147221164 (80040154)': Class not registered."
Private Sub cmdTestConnection_Click()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=SQLOLEDB.1;Initial Catalog=dbname;Data Source=mrtestpc2\sql2000pwd;Extended Properties=uid=sa;pwd=passwordhere;"
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
conn.Open
rs.Open "select * from tablename", conn 'ERROR here
MsgBox CStr(rs.RecordCount)
End Sub
The references that might be relevant to this issue which I have ticked is: Microsoft ActiveX Data Objects 2.8 Library
I've tried with different versions with the above reference, from 2.8 to 2.5 but still get the same problem.
EDIT: I'm trying to figure out whether it's an MDAC issue. EDIT: I'm running windows xp sp3.