Question Connection String for Both MS Access 2003 & 2007?

jsurpless

Well-known member
Joined
Jul 29, 2008
Messages
144
Programming Experience
Beginner
Can someone tell me if it is possible to generically connect to MS Access?

Originally, when my users were on Access 2003, I used

VB.NET:
strMSAccess_Connection_SQL = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDatabaseFilePath

MSAccess_Connection = New OleDbConnection(strMSAccess_Connection_SQL)

and then when they upgraded to Access 2007, I had to change it to this...

VB.NET:
strMSAccess_Connection_SQL = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strDatabaseFilePath

MSAccess_Connection = New OleDbConnection(strMSAccess_Connection_SQL)

However, it seems that if someone using Access 2003 uses the new version - they get an error

"The Microsoft.ACE.OLEDB.12.0'provider is not registered on the local machine"

I assume that this is because the support isn't installed, as it clearly didn't exist in 2003...

Is there anything I can do to allow use of different versions of MS Access?

Thanks!

-Justin
 
But make sure that access 2007 is installed there is big difference between all 2003 and 2007 office products this is where everything became XML -Based you need to have office 2007 to connect to an access 2007 database. You may be able to try to just get an odbc driver and connect through ODBC but I am not sure if there is a work around to open 2007 access databases without having office 2007 installed.

As for the connection string, This is the ultimate resource for creating connection strings to all databases, maybe this will prove helpful:

ConnectionStrings.com - Forgot that connection string? Get it here!
 
But make sure that access 2007 is installed there is big difference between all 2003 and 2007 office products this is where everything became XML -Based you need to have office 2007 to connect to an access 2007 database. You may be able to try to just get an odbc driver and connect through ODBC but I am not sure if there is a work around to open 2007 access databases without having office 2007 installed.

As for the connection string, This is the ultimate resource for creating connection strings to all databases, maybe this will prove helpful:

ConnectionStrings.com - Forgot that connection string? Get it here!

Thanks... I found there what I am doing presently (4.0 and 12.0)... granted, I'm far from an expert but I didn't see anything that discussed being able to use the same string for both 2003 & 2007...

Thanks!
 
Back
Top