ImportXML

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
 
G

Graham R Seach

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
 
K

Kurt

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:eek:d="urn:schemas-microsoft-com:eek:fficedata"
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.
 
G

Graham R Seach

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
 
K

Kurt

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top