Finding The Mscomctllib On Windows 64 Bit Round 2, Any Version
Oct 3 2016, 01:35 PM
Utterly Crispy UA Forum Administrator
Joined: 29-September 01
Why doesn't my database created on a 32 bit version of Windows find the MSCOMCTL.OCX on a 64 bit version of Windows?
I have seen this question asked multiple times on different forumns so I thought it was time to post a solution.
First I will explain why you get this error. It has been moved to a different location on a 64 bit version of Windows so you first have to determine which version of Windows your database is running on. Then you have to set the reference programicly by adding the reference from file when the database is first opened.
The way this code works is when database first opens up I check if Windows is 32 or 64 bit. Then I check if the reference exsits and if it does I remove it. I then have the ability to add the reference back in using the proper location determined by the results of previous check that provided what the configuration the computer running the database has.
In my previous POST I tried using the IsWow64Process API along with others only to discover that incorrect results were being returned from Windows 10 Enterprise 64 Bit and Windows Server 2008. In that post I was determining if Access also was 32 Bit or 64 Bit which was needed to be done to properly call the API's. After further testing I simplified the code as the only reason the MSCOMCTL.OCX was in a different location was due to the bitness of Windows.
I decided to use a WMI Script to bring back the Windows version's architecture and drive letter and set the reference from there. When you look at the code you will see the only two locations it can be in. By using the script I am able to eliminate all the API's and should make it compatible with Windows 2000 and up with out setting a reference to WMI Scipting. This code should be able to be run in any VBA event driven program like Excel.
I have attached a demo database in Access2K , Access2K7 and Access2K13.
Hopefully this will give a way to easily end this pesky problem.
|Search Top Lo-Fi||19th January 2017 - 07:53 AM|