You may receive a "Microsoft Access Cannot Create Table" error message when you try to import XML in Access 2002 (286808)
The information in this article applies to:
This article was previously published under Q286808 Moderate: Requires basic macro, coding, and interoperability
skills.
This article applies to a Microsoft Access database (.mdb) and to a
Microsoft Access project (.adp).
SUMMARY When you try to import XML, you may receive the following
error message: Microsoft Access cannot create table(s)
using the information contained in the document(s) you are trying to import.
This article explains the possible causes of this error message.
MORE INFORMATION In Access, you can import element-centric XML data from an
XML data file. There are circumstances when Access cannot import data from the
document that you are trying to import, and when this happens, you receive the
error message that is mentioned in the "Symptoms" section of this article.
Possible causes of this error are as follows. The XML Is Not Well-Formed Microsoft Access uses the Simple API for XML 2.0 (SAX) when
importing XML data. If SAX determines that the XML is not well-formed, the
error occurs. To import XML data into Access, it must be well-formed. To check
if the XML is well-formed, you can open the document in Microsoft Internet
Explorer 5 or later. If the document opens without an error, it is well-formed.
The XML Has Insufficient Information In order to import XML, Access looks for a root element and at
least one child element that is used as the table name. Although the following
XML is well-formed, it does not contain enough information for Access to import
it:
<test>
</test>
In this case, you have to modify the document to provide more
information. Without an XML Schema (XSD) or a transform (XSLT), the general
structure of an XML document imported into Access must be as follows:
<rootnode>
<tablename>
<field1>test</field1>
<field2>data</field2>
</tablename>
<tablename>
<field1>hello</field1>
<field2>world</field2>
</tablename>
</rootnode>
If you import this XML document into Access, it creates a table that is
named tablename with two fields, field1 and field2, and two
records. You Are Using a Reserved Word Using the example from the "Insufficient Information"
section, if your tablename is one of the following words, you receive the error
message that is mentioned in the "Symptoms" section:
In this case, change the rootnode or tablename to a name other
than the words "dataroot," "root," or "schema." NOTE: If you use the word "schema" in place of the rootnode or the
tablename, you first receive the following warning for each occurrence of the
opening <schema> tag: The document(s) you are importing contain XML Schema (XSD) information created outside Microsoft Access. XML Schema information created outside Microsoft Access is not supported. If you continue, Microsoft Access will only import the data, and ignore the XML Schema.
Would you like to continue? REFERENCESFor more information about working with XML data and Access,
click Microsoft Access Help on the Help menu, type XML data in the Office
Assistant or the Answer Wizard, and then click Search to view the topics returned.
For additional information about importing XML
data into Access, click the following article number to view the article in the Microsoft Knowledge Base:
285329
You cannot import attribute-centric XML in Access
For more general information about XML, see the
following Microsoft Web site:
Modification Type: | Minor | Last Reviewed: | 8/19/2004 |
---|
Keywords: | kberrmsg kbhowto KB286808 |
---|
|