question

DENTDavidCNHIndustrial-9913 avatar image
0 Votes"
DENTDavidCNHIndustrial-9913 asked DENTDavidCNHIndustrial-9913 answered

How do I utilise either the 32 bit or 64 bit installation of the Microsoft Access database Engine.

I have a 32bit Visual Basic program running on a 64bit workstation that imports XL data using a 32 bit Access database Engine.

We have to replace all of the 32 bit Access installations with 64 bit access database engines over two years, so some workstations will have the 32 bit Access Database Engine and some the 64 bit Access Database Engine.

How do I modify my program to work with the 32 bit or 64bit Access database Engine, depending on whichever is present?

We have some 5,000 workstations so replacing the 32 bit access database Engine with the 64 bit Access database Engine over night is not a likely scenario.

office-vba-dev
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You would write a smart setup program that installs either A or B.

0 Votes 0 ·
DENTDavidCNHIndustrial-9913 avatar image
0 Votes"
DENTDavidCNHIndustrial-9913 answered

Many thanks for your answer.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

cooldadtx avatar image
0 Votes"
cooldadtx answered cooldadtx commented

I presume that your app is a VB.NET app and that you're compiling for Any CPU. The default behavior in this case is to run as x86 even on x64 machines. Thus you are in a tough situation here. There really isn't a good workaround because your app is going to run as x86 even on Win64, as you want it to. If you were to disable this behavior then suddenly your app would be running x64 on Win64 (your future goal) but you haven't yet updated the drivers.

I'm curious if your admin team has worked around the issue that you cannot install Access x64 Database Engine with the standard Office x86 installed. Either you aren't using Office (which means you don't need Access) or you are also upgrading at the same time to x64 of Office (which means some addins won't work anymore). There is a way to install the Access x64 Database Engine with Office x86 installed (and hence you will have both x86 and x64 Access drivers installed as documented in several places.

My personal thought is that you should leave your app unchanged and targeting x86 (with Access x86 driver) until all the machines have been updated to x64. Then change the compiler flag to not prefer x86, recompile and redeploy your app. Then you are using the Access x64 driver (assuming you set up DSN correctly) and can remove the x86 Access driver at your leisure.

If that isn't an option for some reason then you have little flexibility. At this point I would set up your build process to build both an x86 and x64 version of your app explicitly. They should produce different binaries in different directories (e.g. myapp_x86, myapp_x64). Then create an Any CPU app that has the same name as your main program (e.g. myapp) now. This bootstrapper program looks to see if the x64 Access driver is available. If it is then it starts the x64 version of your real app otherwise it starts the x86 version instead. Redeploy your app and users will be running one or the other depending on situation.

When the upgrade is finally complete you can revert back to just the single app for x64 without the bootstrapper and no one will know.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for the quick response.

Our Admin team will start to deploy the 64bit Access Database Engine and 64 bit Office with new workstations only. The 32 bit Access Database Engine will be replaced when the lease expires on the workstations. So we could have a mixed environment for up to 5 years.

So your last suggestion of compiling two separate versions and execute the one relevant to the available Database Engine is appealing. My obvious next question is how do I check to see if the x64 Access driver is available?

0 Votes 0 ·
cooldadtx avatar image cooldadtx DENTDavidCNHIndustrial-9913 ·

If you're updating only when you replace machines then do you need to be able to make updates to the x86 version anymore? If not then you can skip all this and just go ahead and recompile your existing code as x64 only. Then just install the new version on new computers. If you need to be able to make builds of both versions for a while then of course this would be more difficult.

To determine if x64 Access is installed you'll need to look at the x64 registry. How you do this depends on how you build your bootstrapper. Since you are probably running at least Win7 on all machine now you are likely running on an x64 platform only already. Therefore build the bootstrapper as an x64 app (uncheck the prefer 32-bit flag if it is set in your project). Now you're running x64 on x64. Then query the registry for the driver. Perhaps something like this:

var value = Registry.LocalMachine.GetValue(@"Software\ODBC\ODBCINST.INI\ODBC Drivers\Microsoft Access Driver (*.mdb)", "") as string;
 var installed = !String.IsNullOrEmpty(value); //Or compare to value of `Installed`


If you are running an x86 bootstrapper then you'd need to load the x64 registry view which is doable, just requires more code. However I doubt this is your situation unless you're running XP or something.

0 Votes 0 ·