Para conectar uma determinada base de dados uso:
ADO
Public Sub ConectarDb()
'On Error Resume Next
Set Db = New ADODB.Connection
With Db
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Properties("Data Source") = App.Path & "BaseDbAdressBook.mdb"
.Open
End With
Set Rs = New ADODB.Recordset
End Sub
DAO
Public Sub ConectarDb()
'On Error Resume Next
Set Db = OpenDatabase(App.Path & "BaseDbAdressBook.mdb")
End Sub
Usando o DAO funciona perfeitamente
strSql = "SELECT * From TblAdressBook WHERE Format(DATA,'mm/dd') Like '*" & Format(Date, "mm/dd") & "*'"
Set Rs = Db.OpenRecordset(strSql)
Usando o ADO não funciona
strSql = "SELECT * From TblAdressBook WHERE Format(DATA,'mm/dd') Like '*" & Format(Date, "mm/dd") & "*'"
Rs.Open strSql, Db, adOpenStatic, adLockOptimistic
O que está errado?