开发者

Microsoft Access 2007 and 2010: "Run-Time Error '429': ActiveX component can't create object"

开发者 https://www.devze.com 2023-03-18 07:11 出处:网络
I am trying to fix a Microsoft Access database that was imported from Access 97 format to Access 2007 format (.mdb to .accdb开发者_Go百科). The import was successful and I was able to make the databas

I am trying to fix a Microsoft Access database that was imported from Access 97 format to Access 2007 format (.mdb to .accdb开发者_Go百科). The import was successful and I was able to make the database fully functional from my machine. It is also fully functional from my coworker's machine. However, when taken to another building that is part of our organization, we cannot get the database to run. We know that part of the problem is within opening a connection to the web server that holds the central database (there are several copies of this Access database that consist of the same code, but different data is input into them and uploaded to this central database). Here is the code.

Public Function updateSqlServer(TransType As String, SqlCommand As Variant) As Boolean


    Dim xmldom As New MSXML2.DOMDocument40
    Dim xmlhttp As New MSXML2.ServerXMLHTTP40

    Const SoapServer = "http://www.example.com/webservice.asp"

   'setup the XMLHTTP object and POST envelope to SoapServer
    toResolve = 5 * 1000
    toConnect = 5 * 1000
    toSend = 15 * 1000
    toReceive = 15 * 1000

    xmlhttp.setTimeouts toResolve, toConnect, toSend, toReceive
    xmlhttp.Open "POST", SoapServer, False  'YIELDS Run-Time Error 429 on this line: xmlhttp.Open
    xmlhttp.setRequestHeader "Man", POST & " " & SoapServer & " HTTP/1.1"
    xmlhttp.setRequestHeader "MessageType", "CALL"
    xmlhttp.setRequestHeader "Content-Type", "text/xml"

    xmlhttp.send (SoapEnvelope)

   'synchronous wait for response; HTTP status other than 200 (OK) is an error
    If xmlhttp.Status = 200 Then
        Set xmldom = xmlhttp.responseXML 'get response into XML DOM document
        Debug.Print (xmldom.xml)         'write soap response to screen
        updateSqlServer = True
    Else
        'handle error
        Debug.Print ("Didn't Work")
        Debug.Print ("status=" & xmlhttp.Status) 'write soap return code
        Debug.Print ("" & xmlhttp.statusText)    'write status text
        updateSqlServer = False
    End If

    Set xmlhttp = Nothing
    Set xmldom = Nothing


End Function

Things we have tried to fix this problem: 1. Added all necessary references (Ex. Microsoft XML) 2. Editing the permissions of the file and the folders 3. Registering ActiveX Controls 4. Made sure all options that can be changed match on both working and non-working machines

This old and is not my code or design. I just have to fix it. Any help will be appreciated.


A coworker of mine figured out the answer. Those variables are objects of MSXML4, and Windows 7 comes stock with MSXML 6.0, which is evidently not compatible with MSXML 4.

Make sure to check install packages before anything else.

You can either install MSXML 4 or change the variables to MSXML 6 by:

Dim xmldom As New MSXML2.DOMDocument6.0

instead of

Dim xmldom As New MSXML2.DOMDocument40
0

精彩评论

暂无评论...
验证码 换一张
取 消