Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Can't Create Object Error with VBScript


1 reply to this topic

Superfreak3

Superfreak3
  • Full Members
  • 437 posts

Posted 06 July 2006 - 17:40

I have a VBScript CA that runs near the end of our install and, for the most part, I have no problems. However, on a certain user's system, I get a 1720 error indicating that ActiveX object can't be created as seen in the verbose log.

Here is the snippet of code used in a .vbs. I've tested this on the user's system to ensure I duplicate the 'broken' state with its execution....

***************************************************
Set cn = CreateObject("ADODB.Connection")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set a = CreateObject("ADOX.Catalog")

TargetFile = "c:\Test\Test.mdb"

If objFSO.FileExists(TargetFile) Then
sTempStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source =" & TargetFile
cn.connectionstring = sTempStr
cn.Open

a.ActiveConnection = sTempStr

For i = 0 To a.tables.Count - 1
If UCase(a.tables(i).Name) = "MYTABLE" Then
WH = "1"
MsgBox WH
End If
Next
cn.Close
End If

Set a = Nothing
Set cn = Nothing

******************************************************

All this does is run through a database to see if a certain table is present. A message box displaying "1" will appear if the indicated table exists.

In my real script and this test script, it is breaking at:

Set a = CreateObject("ADOX.Catalog")

In the actual insall log, I get:
-2146827859, Microsoft VBScript runtime error: ActiveX component can't create object: 'ADOX.Catalog'.

What ActiveX dependency is the user's system missing? Or, how can I go about finding what is missing?

Any help is greatly appreciated, as always.

Superfreak3

Superfreak3
  • Full Members
  • 437 posts

Posted 07 July 2006 - 14:33

I've found that if I alter the script in either of the following ways, I can work around the problem.....

Set a = CreateObject

Or

On Error Resume Next
Set a = CreateObject("ADOX.Catalog")
On Error Goto 0