30 January 2007

Connect To Access 2007 From Pre-2007 DB

Need to connect to an Access 2007 format database, but don't have Access 2007 installed yet? Or do you need to connect to any other Office 2007 formatted file or to Sharepoint Services and don't have them installed? Download the Data Connectivity Components of the 2007 Office System Driver, which includes the ODBC and OLEDB drivers for the ACE (accdb) and Jet (all versions of mdb) database engines, a driver for Microsoft Office Excel 2007 (xls, xlsx, and xlsb), and a driver for Sharepoint Services.

To connect to an Access 2007 database file without security using OLEDB, use this connection string (all one line):

"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\MyDir\MyDB.accdb;Persist Security Info=False;"

To connect to an Access 2007 database file with a database password using OLEDB, use this connection string (all one line):

"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\MyDir\MyDB.accdb;Jet OLEDB:Database Password=MyPswd;"

To connect to an Access 2007 database file without security using ODBC, use this connection string (all one line):

"Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\MyDir\MyDB.accdb"


To connect to an Excel 2007 file using ODBC, use this connection string (all one line):

"Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\MyDir\MyFile.xls"

No comments: