Link to home
Start Free TrialLog in
Avatar of pgins
pgins

asked on

WindowsXP service pack2 : Error429 ActiveX component can't create object

Only on windowsXp service pack 2, I am unable to run my application.
I created a small sample hereby included which doens't work on Xp 2

The error from above arises on : "Set dbConn = New ADODB.Connection"

Any idea please?

Option Explicit
Dim dbConnection As ADODB.Connection
Dim dbConnection_Selections As ADODB.Connection
Dim strConnection As String
Dim rsTable As ADODB.Recordset
Dim rsTable_Selections As ADODB.Recordset

Private Sub Form_Load()
Screen.MousePointer = vbHourglass
DoEvents
SendToErrorFile "DBS is being loaded", True
DB_OpenLocalDBConnection dbConnection, "C:\wvb.mdb"
DB_OpenLocalDBTable dbConnection, rsTable, "tbl_Data"
SendToErrorFile "DBS loaded", False
Screen.MousePointer = 0
End Sub

Sub SendToErrorFile(msg As String, bKill As Boolean)
Dim strfile As String
Dim nFile As Integer
nFile = FreeFile
strfile = "c:\0Testfile.txt"
If bKill = True Then FileExist strfile, True
Open strfile For Append As nFile
Print #nFile, Format$(Now, "d mmm yyyy hh:mm:ss") + " - " + msg
Close #nFile
End Sub

Sub DB_OpenLocalDBConnection(dbConn As ADODB.Connection, strDBFile As String)
Dim strConnection As String
'strConnection = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" + strDBFile
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" + strDBFile
SendToErrorFile strConnection, False
Set dbConn = New ADODB.Connection
SendToErrorFile "db Connection Set", False
dbConn.Open strConnection
SendToErrorFile "db Connection Opened", False
End Sub

Sub DB_OpenLocalDBTable(dbConn As ADODB.Connection, rst As ADODB.Recordset, strTableToOpen As String)
   Set rst = New ADODB.Recordset
    SendToErrorFile "Table Set", False
   rst.CursorType = adOpenKeyset  'adOpenStatic
   SendToErrorFile "CursorType Set", False
   rst.LockType = adLockOptimistic  'adLockBatchOptimistic
   SendToErrorFile "LockType Set", False
   rst.Open strTableToOpen, dbConn, , , adCmdTable
   SendToErrorFile "Table Open", False
End Sub

Function FileExist(strFileName As String, Optional KillIt As Boolean, Optional CopyKillIt As Boolean) As Boolean
Dim nFile As Integer
On Error Resume Next
nFile = FreeFile
Open strFileName For Input As nFile
If Err.Number <> 0 Then
    FileExist = False
Else
    FileExist = True
End If
Close nFile
If KillIt = True Then
    Kill strFileName
End If
End Function

Avatar of EDDYKT
EDDYKT
Flag of Canada image

Have you added the ms ADO reference?
Avatar of pgins
pgins

ASKER

In the ref I have the Microsoft ActiveX Data Objects 2.5 Library  msado25.tlb

Additional info : I used the microsoft application wizard to create a setup for the demo hereby included
and indeed this file gives a can't registration error on xp version2


Avatar of pgins

ASKER

Additional info:
after replacing the msado25.tlb by the msado15.dll the setup needs the mdac_type.exe
when downloading mdac_type.exe 2.8 from microsoft and trying to install mdac we have MDAC 2.8 RTM incompatibilty error.

Indeed the register already contains in
LOCAL_MACHINE\SOFTWARE\Microsoft\DataAccess\fullinstalvers = 2.81.1117

Which file is missing or what should be changed in the source to make it compatible with xp version2 ?



Avatar of pgins

ASKER

After installing mdac 2.8 on proper unit, the reference file msado15.dll is in VB automatically replaced by msado27.tlb.
But after compilation and reinstalling a new created setup file : still the same error on WindowsXP Sp2
I also verified if those files are on the xp sp2 unit; they are.
Somebody has any idea please?


1. Have you tried to add 2.8 as ado reference on your vb project?

2. You can also use late binding

ie

Dim dbConnection As object


set dbConnection =createobject("ADODB.Connection")

etc

Avatar of pgins

ASKER

1. Yes I did so
2. Replaced code with yr proposal

Private Sub Form_Load()
Dim dbConnection As Object
On Error GoTo errorhandler
  SendToErrorFile "DBS being loaded", True
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\wvb.mdb"
  SendToErrorFile strConnection, False
Set dbConnection = CreateObject("ADODB.connection")
  SendToErrorFile "Setted", False
dbConnection.Open strConnection
  SendToErrorFile "db Connection Opened", False
Exit Sub
errorhandler:
MsgBox Str$(Err.Number) + ":" + Err.Description + Str$(Err.HelpContext) + Err.HelpFile
End
End Sub

Result from testfile should be :
6 okt 2004 14:09:44 - DBS being loaded
6 okt 2004 14:09:44 - Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\wvb.mdb
6 okt 2004 14:09:44 - Setted
6 okt 2004 14:09:45 - db Connection Opened
6 okt 2004 14:09:45 - DBS loaded

But error 429 (1000429) on XP SP2 before object is set online : Set dbConnection = CreateObject("ADODB.connection")
Meanwhile it seems to work on some XP SP2 units and on some not.
When latest MDAC or JET is loaded from microsoft > no way to start setup since files on unit are more recent then the downloaded files




You meant it still failed on the line

Set dbConnection = CreateObject("ADODB.connection")


?
Avatar of pgins

ASKER

Yes it do (sorry for my long answer I only want to give maximum info)
ASKER CERTIFIED SOLUTION
Avatar of EDDYKT
EDDYKT
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
Avatar of pgins

ASKER

Tried both, still the same
Avatar of pgins

ASKER

I replace ref by Microsoft DAO 3.6 Object library (dao360.dll)
Removed all adodb.connections
Replaced dbconnection.execute by dbconnection.openrecordset and a few other items

Dim dbConn as database
Dim rst as recordset

Set dbConn = OpenDatabase(strDBFile)
Set rst = dbConn.OpenRecordset(strTableToOpen)

works fine with XP sp2

So if somebody search for 429 error on xp sp2 : remove all yr adodb connections, I gave it up after 4 days.
I don't thine there is problem

Now you use DAO instead of ADO