My development machine has VB6 SP6, XP Pro SP2, MDAC 2.81, Jet 4.0 SP8
I've developed a fairly simple frontend desktop application in Visual Basic 6. It interacts with a MS Access database. I've included the reference to "Microsoft ActiveX Data Objects 2.8 Library". I can compile and run the application on my development system, as well as numerous other platforms, including XP Pro/Home SP1/SP2.
Now, my problem is this:
I have installed the program on to a Dell Inspiron 1100 laptop with XP Home SP2. When attempting to run the application it encounters the famous runtime error 429 "ActiveX component can't create object". This happens at the time the program tries to create the ADO object.
Here is a sample of the code:
Public Function OpenDB(strDBPath As String) As Long
On Error Resume Next
'Prompt for database location if default location doesn't exist
If Dir(strDBPath, vbNormal) = "" Then
MsgBox "Database is not found!" & vbCrLf & "[" & strDBPath & "]", vbCritical, "Database Not Found"
OpenDB = 1
'Set the connection string for the Jet 4.0 datasource
sCn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;" & _
"Mode = " & adModeReadWrite & ";" & _
"Data Source = '" & strDBPath & "';"
'Initialize the ado control
adoCn.ConnectionString = sCn
OpenDB = Err.Number
adoCn is a public variable as type ADODB.Connection. Just before I call that function in the Sub Main I initialize the adoCn variable as follows:
Set adoCn = New ADODB.Connection
I'm not sure why this works on all other computers except the ONE computer. I've checked the MDAC dll's, tlb's, and everything else in the Program Files\Common Files\System\ADO directory. I've also tried running the latest version 2.8 of MDAC_TYP.exe downloaded from Microsoft's website. And, as a last resort I've tried installing the latest version of Jet 4.0 SP8. Trying to install either of those on a XP SP2 machine tells me that they're outdated.
Other things I've tried are using ADO 2.7 and creating the object with the CreateObject function. All of these give the same runtime error.
Thanks in advance for any help!