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

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
cmccurdyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DarrenSenior Software EngineerCommented:
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
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cmccurdyAuthor 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.
0
DarrenSenior Software EngineerCommented:
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
0
cmccurdyAuthor 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)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.