ADO Connection String for Access 2007 Database
Here is the ADO connection string example for Access 2007 database.
Set Cn = New ADODB.Connection
Cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\comp\Documents\SampleDB.accdb;Persist Security Info=False"
If the database needs password then use the following string:
Cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\comp\Documents\SampleDB.accdb; Jet OLEDB:Database Password=MyDbPassword;"
The project that uses the code should have reference to ActiveX data objects library