Using Access 2016 (64 and 32)
Recently had the need to read a JSON file to populate a table
Seems straight forward but keep hitting walls.
I came across this example but can't even get the code to run.
Yes I know it using the XMLHTTP but that is only for the GET, however, it fails with "Compile Error: Can't Find Project or Library"
Don't know if this will even work, but I thought I would try and dissect it to see.
Anyone else using JSON? Is there a better way, pretty much a noob when it comes to this. However the JSON I am getting is very complex and has several nested objects.
I must be missing something.
Public Sub ReadXML()
Dim reader As New XMLHTTP60
Dim doc As DOMDocument60
reader.Open "GET", "http://localhost:55834/api/contacts", False
reader.setRequestHeader "Accept", "application/xml"
reader.send
Do Until reader.ReadyState = 4
DoEvents
Loop
If reader.Status = 200 Then
Set doc = reader.responseXML
doc.Save "c:\Northwind\Contacts.xml"
Application.ImportXML "c:\Northwind\Contacts.xml", acStructureAndData
Else
MsgBox "Unable to import data."
End If
End Sub