Here is what I always use in my programs:
You need to reference msado20.tlb (Microsoft ActiveX Data Objects 2.0 Library).
Code:
Dim db As New Connection
Dim adoRS As New Recordset
Dim ConnectionString As String
ConnectionString = "Provider=MSDASQL;dsn=YourDSN;uid=UserID;pwd=Password;"
db.Open ConnectionString
Dim strSQL As String
strSQL = "select something from wherevever"
adoRS.Open strSQL, db, adOpenStatic, adLockOptimistic
'You now can access the recordset adoRS like this:
Dim Temp As Variant
Temp = adoRS.Fields("something")
I hope this helps