views:

381

answers:

2

I keep getting this error when I try and use a MS Access database in my application:

The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

After Google'ing the error for a while I came to see that this is a problem when running the application in 64-bit mode. If I was to compile the app in 32-bit it would work, so I went to try and find out how to do it. I got as far as the advanced compiling options in my projects settings page, but then I also read that I can't even set the CPU type in Visual Basic 2008 Express.

is this true? Is there no way I can set my project to run in 32-bit mode? The thing is, I did a similar thing with a database a few months ago and this worked, and I don't remember in the slightest what I did.

Can anyone shed some light? Thanks.

EDIT: After taking a look at my old projects compiling options, it is indeed set for Active (x86) Platform, but this option is not showing up in my new project. Weird.

EDIT 2: Here's a screenshot. Top one is the old project with the 32-bit running option and the bottom is the new one without those options.

http://i49.tinypic.com/9kb1ar.jpg

A: 

You can always use MSbuild it is free and will allow you any configuration option available to the complier.

rerun
Thanks for the answer. From what I see MSBuild is just a compiler yes? And is there a way to do it in VB 2008 Express itself? I'd rather do that because I need to take this project around with me and compiling from the IDE itself will be a bonus, but is MSBuild is the only way then I'll have to use that.
James
its more like make. You can always debug your app in the IDE.
rerun
+2  A: 

I haven't used VB Express myself (I use Visual Studio Professional) but I figure the options will be similar. After you open the solution (or project):

  1. Open the Project Properties. (Right click the Project in the solution explorer and select properties).
  2. Click on the Build tab.
  3. In the Platform Target drop down, select x86.
  4. Click Save.

You should now be able to build the application and force it to 32-bit.

If you wish to have separate builds (one for Any CPU and one for x86):

  1. Click on the Build menu.
  2. Click Configuration Manager...
  3. In the Active Solution platorm drop down click
  4. In the Type or select the new platform drop down select x86.
  5. Make sure Create new project platforms is checked.
  6. Click OK.

You can now choose between the Any CPU or x86 CPU types easily. Just select the platform type from the Standard toolbar.

If you need to change an older program or one you can't compile, see my answer on how to force applications with the Any CPU flag to run as 32-bit.

Joshua
+1 for the 2nd part of your answer. The first one will perhaps only work with Visual Studio Pro or TS, since "different platforms" is one of the features the Express editions of VS are missing, when I remember correctly.
Doc Brown