Install ADO appl on user's machine

My application (VB6) uses ADO 2.1 to access an MS-Access2000 database. I have set up an installation script using the Packaging and Deployment Wizard. Alas, on some (not all) machines the application installs and starts up fine, but returns and error when trying to access the database file for the first time. Some of my problem machines have Access2000, some do not, some are Win2000, some are Win98 or 95.
I have not included any other files in my installation than my own files and whatever P & D Wizard includes automatically.
Are my necessary run-time files out of date ? Is there a newer version of ADO I should be using instead ? I have heard that there are problems/bugs so that I should download a newer version, but what ? Is it enough to just e-mail a newer version to the user, or do I have to re-make the whole installation package ?
Appreciate if anybody could enlighten me about ADO and current affairs.
Who is Participating?
TimCotteeConnect With a Mentor Head of Software ServicesCommented:
Anne, that version of the executable is the original distribution of VB6, ( ) without any service pack. I would strongly recommend that you firstly upgrade your VB installation on the development machine to at least SP3 ( )  and ideally SP5 ( ). SP5 will require that you install MDAC_TYP v2.51 or higher before you perform the upgrade. If you do this and then uncheck ADO 2.1 and check ADO 2.5 in the project, recompile and repackage it then install on the win2000 machine you can be reasonably confident that all the appropriate versions will be installed on this machine and that there shouldn't be any dll incompatibilities. The error message that you show (-2147220999) actually translates as: (800401F9)    Error in the DLL so I would not be surprised if there is a dll incompatibility here.

Now if you encounter a problem when recompiling on the event procedures for the ADO data control (and you may well do so) to the effect that the procedure declaration does not match then there is a quick work-around to this. Simply change the ADODB.Recordset to ADODB.Recordset20 in the last parameter of each event declaration. The application will then compile perfectly and work properly. This is because of a change in the interface from ADO 2.0 to ADO 2.1.

Hope this helps,
Check to see that you have Mdac_typ.exe in your package. This is the key to ADO.
Check the version too - version I have here is 2.50.4403.12 which works fine for me. You should be able to get the latest release from MS.
TimCotteeHead of Software ServicesCommented:
AnneL, to start with you must ensure that MDAC_TYP.EXE is included in the package that you create. This will install the necessary ADO components on the target machine(s). The file is found in the \program files\microsoft visual studio\vb98\wizards\pdwizard\redist folder on your development machine. If it is not there or you have an older version than you expect this may cause problems. You can install this seperately to the application if you so wish. The version I would recommend of ADO is 2.51 as this includes the jet drivers required for access (2.6 doesn't and they have to be installed seperately) and fixes a number of issues with earlier versions.

For windows 9x machines, you have to ensure that DCOM95 or DCOM98 is installed as appropriate (DCOM98 should work on 95 machines as well as 98 ones).
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

AnneLAuthor Commented:
I checked the MDAC_TYP.EXE file in the mentioned directory. When I start it it says 2.0. So definitely out of date here. I assume that installing MDAC 2.51 on Win95 & 98 machines will sort my problem out.
BUT. I have one Win2000 machine on which I have done a Software scan (used to list s/w and drivers installed). I find here a library called msdadc.dll (Microsoft Data Access Components) version 2.51.5303 ( and this is the only version). That tells me that MDAC 2.51 is already on this machine. Acording to MSDN this comes with Win2000 Service Pack 1. If this library is already on the machine what on earth is then wrong ? (My application's error msg indicates that it doesn't understand the first ADO command it hits in the code). Any more ideas, or should I tell my user to buy another machine ??
TimCotteeHead of Software ServicesCommented:
AnneL, what is the precise error message that you get in this instance? There are a number of possible reasons for this which may be tied into mismatched ADO components. For example if you are using the ADO data control from VB6 SP3 and below but are using MDAC_TYP version 2.1 or higher then there is a definite problem that can easily be sorted. I cannot say without knowing the error message whether it is anything of this sort or not but there is undoubtedly a solution which will work for the Win2000 machine.
AnneLAuthor Commented:

my code is as following :
    Set mDB = New uDatabase  
    Set mRS = New ADODB.Recordset
    mRS.Open "Projects", mDB.ConnectDB, adOpenKeyset, adLockOptimistic

It fails when it gets to the mDB.ConnectDB function. In this function I THINK it fails at:
Set connection = New ADODB.connection
or when I try to set the connection's  ConnectionString (= "Provider=Microsoft.Jet.OLEDB.4.0;" & _
         "Data Source=" & DBName & ";" & _
        "Persist Security Info=False" )

The error msg I capture in my error log is :
err.Number = -2147220999,
err.Description = Method '~' of object '~' failed

Not very descriptive...

If you'd like I'd put some more traces into the program and run it again on my user's machine, if that can help you to help me.
I don't know what service pack for VB I have on my machine but my VB6.exe is version 6.00.8176. In project References I have ticked "Microsoft ActiveX Data Objects 2.1 Library" (msado21.tlb). I have also "DAO 3.6 object library" (dao360.dll) here because I use a function there to compact my database.

(I've also increased the points to 200)
AnneLAuthor Commented:
Thanks Tim, for a very clear answer.
I will try and download these files (lots of MB for my poor BT phoneline...), remake the installation script and let my user try the installation again on his machine. I will let you know whether I am succesful or not !
TimCotteeHead of Software ServicesCommented:
Please do Anne, if it doesn't work then post a comment here and we will try again. I know the feeling, that is why I hardly ever download anything at home. I download it at work and then burn a CD and take it home. A bit fiddly sometimes but a lot less pain in the long run. I was going to have ADSL at home but thanks to the wonders of BT I cannot get it so I too am stuck there with a lowly 56K modem.
AnneLAuthor Commented:

I am sorry, but our fix didn't work. My user still gets exactly the same error messages.
What I have done is downloaded SP5 for VB. Installed MDAC 2.51 first and then installed the whole Service Pack. Then I opened my project, in Project References de-selected ADO 2.1 and selected ADO 2.5. Recompiled my DLL. Opened my application project, re-referenced my DLL and created an executable. Just to clarify : It is my DLL that accesses the database, my executable references this DLL.
Then used the P & D Wizard to make an installation script. MDAC_typ.exe was now included in the installation - which is wasn't last time. (and the right version sits in the P & D W /redist directory).
On top of that were lots of other "new" files that seemed to be needed by dao360.dll. Only reason why I include this particular file is to use the CompactDatabase utility. I wonder if referencing DAO3.6 and ADO 2.x in the same project can cause problems ??
But again my set-up works on most machines - but I know of one more, an NT, that gets the same errors.

Do you have any more ideas ? Of course this particular laptop could be a weird one, but being a BP corporate one, I doubt it...

Appreciate any sort of input :-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.