ImportXML

  • Thread starter Thread starter Kurt
  • Start date Start date
K

Kurt

I am trying to import a .xml file that I exported out of access.

Application.ImportXML _
DataSource:="C:\temp\Customers.xml", _
ImportOptions:=acStructureAndData

There are no tables in the database called Customers.

I ran this code once and it worked.

I cannot get it to work again. I get this error:

Error 31521: cannot establish connection to the server

Any Ideas?

Thanks in advance for any help.

K
 
Kurt,

Did you use the acEmbedSchema argument when you exported the table? If not,
then my guess is that Access doesn't know where to put the data.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
I am using Acc2003. This is the code for the export:

Application.ExportXML _
ObjectType:=acExportTable, _
DataSource:="Customers", _
DataTarget:="C:\Temp\Customers.xml", _
SchemaTarget:="CustomersSchema.xml"

I moved the database to my laptop, exported the table and imported the table
back into the database. All worked fine.

The first few lines in the exported Microsoft xml file that I can re-import
look like this:
<?xml version="1.0" encoding="UTF-8" ?>
- <dataroot xmlns:od="urn:schemas-microsoft-com:officedata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="CustomersSchema.xml"
generated="2007-08-01T15:03:36">
- <Customers>
<OwnerID>1</OwnerID>


I have customer xml files that start like this:
<DMRValuesSet>
<DMRValuesItem>
<DMRRptId>1634</DMRRptId>
<DMRValId>818779</DMRValId>

This also can be imported into the database on the laptop. All works fine
on the laptop but not on my production computer.

K.
 
Kurt,

Save the schema file as "CustomersSchema.xsd", not "CustomersSchema.xml".
That should fix the problem.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Thanks for the help.

I used a restore point and that somehow fixed the problem.

As a test, I'll try the .xsd and see what happens.

Kurt
 
Back
Top