SQL Connection To Access - 2007 vs 2003?

jsurpless

Well-known member
Joined
Jul 29, 2008
Messages
144
Programming Experience
Beginner
Hi

My application currently works with Access 2003 using the following approach...

VB.NET:
strMSAccess_Connection_SQL = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDatabaseFilePath
MSAccess_Connection = New OleDbConnection(strMSAccess_Connection_SQL)

MSAccess_Connection.Open()

When I load it onto a WinVista machine running Office 2007, I get the following error

VB.NET:
the microsoft.jet.oledb.4.0 provider is not registered

I was doing a little research and I guess 2007 changed a few things? Introduced something called ACE? I tried using

VB.NET:
"Provider=Microsoft.ACE.OLEDB.12.0", etc

but I get a similar error to the above...

Thoughts?

Many thanks!

-Justin
 
OK, it looks like I was able to solve this by adding the following line to my project file

VB.NET:
<PlatformTarget>x86</PlatformTarget>

Looks like I had to do it this way since I am using VBExpress and this is not exposed?

I added this on my 32-bit machine and all still seems to work... sound about right?
 
This is exposed in the Compile tab for the project properties.

From Solution Explorer double click on My Project and go to the Compile tab. Click on the Advanced Compile Options button and you can change it in the Target CPU ddl.
 
In VBE in Platform dropdown click the <new> and select the target CPU. Only the "any cpu" profile exists by default.
 
Oh, I didn't notice Compile tab was mentioned, VBE has no interface to manage this in Compile tab. In VBE you have to enable the "Show advanced build configurations" (in VBE 2008 this is in Options, Projects and Solutions, General), then the Configuration Manager will appear in Build menu.
 
Back
Top