Link to home
Start Free TrialLog in
Avatar of karnovsk
karnovsk

asked on

ActiveX component can't create object

I have written a program on Windows 95 (the "development machine"), which creates a database using ADOX and populates and manipulates it using ADO.

I have packaged the program using the Microsoft Visual Studio Installer. The program installs and runs OK on the development machine.

However, when I have installed and tried the program on a W98 computer (the "target machine"), I've got an error message "ActiveX component can't create object". It happened when the program called a subroutine whose first statement was:

      Dim rst As New ADODB.Recordset

I understand that the error means that the program could not create the recordset object.

Note that the error happened AFTER the program had successfully created a database on the target machine.

Any ideas?
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Normally, this means that mdac (ADODB) is not of the appropriate version.
You probably developed your appliation in a higher version than exists on the target machine.
Check the version of mdac_type.exe (or similar) on target and development machine. You should add ADO in your setup.
hope this helps
Have you installed DCOM98.EXE on this computer? Try it and then resinstall your application.
Avatar of karnovsk
karnovsk

ASKER

To angelIII: I think your answer is in the correct direction. How do I add ADO to the setup with Visual Studio Installer?
It should be automatically detected!

Do you have file named MDAC_TYP.EXE in the list of files to be distributed?
Hi emoreau,

When I was using the old Package & Deployment Wizard, I could see MDAC_TYP.EXE in the list of files, and indeed it used to install ADO before installing the program proper.

Now, with the Microsoft Visual Studio Installer, I see a module named MDAC.MSM in the list of files, but I don't know what does it exactly mean, and it DOES NOT install ADO.
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have found the following note in the MSDN article "Installer Package Files and Merge Modules":

Note   Unlike all other merge modules Visual Studio Installer provides, the mdac.msm file does not install Microsoft® Data Access Components when the installer package it belongs to is run. Instead, mdac.msm simply checks for the presence of Microsoft Data Access Components on the target machine.

So the question is how to force the Installer install MDAC.
Have you read the link I just gave you. It talks about a wrappersetup.
I don't know Visual Studio Installer, but i think you should be able to add the mdac_typ.exe to the list of distributable files.
karnovsk, I know my suggention is going to be very strange, but I am a System Developer and I have had that problem a lot of times.

What I normally do is:
*Make sure that I am using ADO or DAO, never both

*Recompile my project, nad make a new exceutable project file.

*Repackage, this is where the strangeness comes in.

*I quickly click on the next buttons, to confuse the Packager.

*In doing this it usually brings up dependency files or other files needed by my application.

*I then go over the identified files, and complete the packaging.

*In the target machine, when I install the application I always pick "No to ALL" when there is a DLL difference.

The DLLs in my package over-write those of the target machine, these is dangerous in situations where the DLL you are over-writing is newer than your own. But all in all this always solves the problem.

Make sure that you are not using both DAO and ADO, most of the times it has nothing to do with DCOM 98, but a missing DLL/OCX or TLB.
>> ... to Confuse the Packager ...

I think it is me now that is confused ?!
I said a strange solution, but it works for me. What I have realised is that when you move the "Next" button fast, the Package Wizard brings up all this other dependency files that it normally does not show when you do it slowly.

What I mean is this:

* Clicking the "Next" button continuosly without waiting for messages from the Package Wizard, that what fast means.

One other thing you can do is to go to the Script Manament utility still in the Package Wizard, delete all the scripts and then re-package the project again.

Another thing that I have noticed is that somethimes there is absolutely nothing wrong with your packaging, the problem lies with the target machine.

What I do here is to re-install Windows in the target machine. It so happens that some of these files (dlls, ocxs) get corrupted(not by your application, but other applications installed in the target machine), and when you install your application it then uses corrupted files giving out the error message that you have. So if the target machine does not contain critical informat just format the hard-disk and reinstall Windows 98.

Remember what I told you, most of the time this problem has nothing to do with DCOM98, but dlls, ocxs, or tlbs. So be sure that the target machine's Windows 98 contains correct dlls, ocxs, and tlbs.
billyh: We're talking about the Windows Installer here, which is a lot more difficult to confuse (and a lot more confusing!) than the Package & Deployment wizard.

The MDAC.MSM file is a merge module. Most merge modules contain the package they need to install, but not the MDAC and DCOM modules (ask Bill why, not me). These merge modules will only check if a current version of the package is installed. The fact that the Installer didn't tell you "Hey, MDAC is not installed, you should do that yourself first!" is proof that this was just another great M$ idea that died a horrible premature death due to wrong design and implementation.

Now for the solution. This is simple, you need to instal MDAC (and DCOM on 95 machines, this is not needed on 98 boxes since DCOM is installed with the OS there) before you install your own package. You can do this manually (or better, let a system administrator do it manually :), or you can follow emoreau's link to get a utility from M$ that does it for you.

Personally I would go for the manual install, but that's just because M$ make it *very* hard to trust their setup utilities. In my own company, the newest MDAC package is always on the standard ghost that gets installed on all the user's computers. This way we never have problems with it, but that will only work if your company uses Ghost or a similar application, of course.
Dear colleagues,

Thank you all very much for the really enlightening discussion, from which I have learned a lot. Following emoreau's advice, I have downloaded the Wrapper program and started using it. I have written a program to be downloaded from an Internet site, therefore I must put eveything in it. I can't tell the user to download and install MDAC first.

Wrapper works OK but it is incredibly ugly (as they say in the old Crocodile Dundee movie: it tastes like **** but you can live on it). After I added the Windows Installer (for 9x and NT) and MDAC, my dowload module swelled from 3.5 MB to 12 MB. Has anybody any idea how to reduce this monster?

Actually, MDAC installation did not solve the original "ActiveX component can't create object" problem, but I think that something is wrong with my target machine. Therefore I thank you all very much again and close this question.
Your "ActiveX component can't create object" should be corrected by installing DCOM98.EXE!

"swelled from 3.5 MB to 12 MB" because of MDAC_TYP.EXE and it can't be broken.
>> Has anybody any idea how to reduce this monster?

You could just put a link to MDAC_TYP.EXE on the Microsoft homepage in your documentation or on your download page. It's freely downloadable if I'm not mistaking. A lot of people will have the Data Access Components already installed, so these people won't need it. Same goes for DCOM.
To emoreau: I have installed DCOM98.EXE, but I still get  "ActiveX component can't create object". When I reboot this computer I get a message telling that ODBC must be reinstalled. Could this be the cause of the above message?

To  Jeremy_D: My problem is that most my program's users  - how to say it politically correct - are rather computer-challenged. I am developing genealogical software, and many my users have a hard time just downloading and installing a single program. If I tell them, "If you don't have ADO download it", they will just drop dead. Not all of them but some may.
Are you using ODBC? What is your connection string?

DCOM98 must be install before MDAC_TYP. Did you followed this sequence?

Are you sure that your error is still on "Dim rst As New ADODB.Recordset" or can't it be another line?
To emoreau: I have installed DCOM98.EXE, but I still get  "ActiveX component can't create object". When I reboot this computer I get a message telling that ODBC must be reinstalled. Could this be the cause of the above message?

To  Jeremy_D: My problem is that most my program's users  - how to say it politically correct - are rather computer-challenged. I am developing genealogical software, and many my users have a hard time just downloading and installing a single program. If I tell them, "If you don't have ADO download it", they will just drop dead. Not all of them but some may.
>> My problem is that most my program's users  - how to say it politically correct - are rather computer-challenged

<sigh> I know the problem.
To emoreau: It took me some time, but I have reinstalled Windows 98 (second edition), DID NOT install DCOM98, installed MDAC 2.5 and my application - and the above problem disappeared.

Thank you again for your help.
It has to do with IE4.0 or greater being integrated into the operating system. If the target machine does not have IE4.0 or greater installed you will get the error "ActiveX component can't create object". Micro$quash, go figure.