Question : Reading XML in to an ADO Recordset

Hi,

I need to get an xml file in to an ADO recordset in MS Access (VB). The file is generated and hosted elsewhere. I'm using the attatched code currently.

This produces the error: "The download of the specified resource has failed".

If I go to the URL, the XML is there. If I replace the URL with another XML file (for example, http://www.w3schools.com/XML/cd_catalog.xml), it works fine, and gives me a record count.

The start of the XML produced by my URL is as follows:

 
- www.systemmonitor.co.uk" status="OK">
-
-
  My Client
 
 
 
  15648
  0shboard>
  0w_wkstsn_assets>
 



The only thing I can note that might make a difference is that the URL I'm using doesn't end in .xml - might that give me a problem?

Thanks in anticipation,

John.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Public Function Test()
   Dim adoConn As ADODB.Connection
   Dim adoRS As ADODB.Recordset
 
   Set adoConn = New ADODB.Connection
   Set adoRS = New ADODB.Recordset
 
   adoConn.Open "Provider=MSDAOSP; Data Source=MSXML2.DSOControl.2.6;"
   adoRS.Open "https://www.systemmonitor.co.uk/api/?apikey=mykey&service=list_clients", adoConn
 
adoRS.MoveFirst
MsgBox adoRS.RecordCount
 
End Function

Answer : Reading XML in to an ADO Recordset

The error could indicate many different things. Are you absolutely certain the XML is valid? Can you move the XML from that resource, place it in a local folder, and then point your code to that local folder/file? If so, does the code work then?

If it does, that would indicate troubles with the location hosting your file.

If it does not, that would indicate trouble with your code (although I'd think not, since you can point your code to a different XML file and all works).
Random Solutions  
 
programming4us programming4us