Error 429 - "ActiveX component can't create object in Access

cmccurdy
cmccurdy used Ask the Experts™
on
I'm trying to post to an API but the routine fails with  Run-time error 429 - "ActiveX component can't create object" on the line ->  Set objHTTP = CreateObject("MSXML6.ServerXMLHTTP")

The code which fails is"

Private Sub cmdCreateAutoTextCustomer_Click()
    Dim objHTTP As Object
    Dim Json As String
    Dim URL As String
    Json = "{""shop_number"": ""8729925026"",""client_code"": ""142KukK231k."",""lastname"": ""Ender"",""phonenumber"": ""5555555559"",""vehicle_year"": ""2009"",""vehicle_make"": ""JEEP"",""vehicle_model"": ""something"" }"

    Dim result As String

    Set objHTTP = CreateObject("MSXML6.ServerXMLHTTP")
    URL = "http://somewebsite.me/api/v1/customers"
    objHTTP.Open "POST", URL, False

   objHTTP.setRequestHeader "Content-type", "application/json"
   objHTTP.setRequestHeader "Accept", "application / json"
   objHTTP.send (Json)
   result = objHTTP.responseText

   'Some simple debugging
   Range("A25").Value = result
   Range("A26").Value = Json


   Set objHTTP = Nothing
End Sub
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Software Engineer
Commented:
Hi,

Can you find the MSXML6 DLLon your machine?

Can you check the registry to make sure that it is registered as a COM DLL?

What version of Access?

Thanks,

Darren

Author

Commented:
Access 2016 (installed as part of Office 365).  Yes the DLL does exist on my machine and I unregistered and registered it to be sure.
DarrenSenior Software Engineer

Commented:
Hi,

Can you try CreateObject("msxml2.ServerXMLHTTP.6.0")

I haven't tested....

This is the progid I found in my registry for msxml6.dll

Thank,

Darren

Author

Commented:
Thanks Darren,  

CreateObject("msxml2.ServerXMLHTTP.6.0") worked.

Now my problem is I'm not getting back the response correctly although the record seems to have been created properly.  

Can you help on that also?  What I'm trying to do is found here. (https://www.experts-exchange.com/questions/29116183/JSON-post-with-Access-VBA.html)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial