I am trying to access a ms access table from a new excel vba workbook using DAO.database/DAO.recordset.
However, i am getting "unrecognised database format" in the opendatabase("path.accdb") line.
Dim a As DAO.Database
Dim b As DAO.Recordset
Set a = OpenDatabase("C:\Users\Sweety\Desktop\Database2.accdb")
Sql = "SELECT Name1,Age FROM Table2 "
Sql = Sql & "WHERE City = 'Berkeley' "
Set b = a.OpenRecordset(Sql)
Sheet1.Range("A1").CopyFromRecordset b
DAO
reference is generic, and should work with nearly any version of Access. – kismert