ImportXML Method

Microsoft Access Visual Basic

ImportXML Method

       

Imports data and/or presentation information for a Microsoft Access object from an XML file or files.

expression.ImportXML(DataSource, DataTransform, OtherFlags)

expression   Required. An expression that returns an Application object.

DataSource  Required String. The name and path of the XML file to import.

DataTransform  Optional String. The name of the XSL file to apply to the incoming XML data.

OtherFlags  Optional Long. A bit mask which specifies other behaviors associated with importing from XML. The following table describes the behavior that results from specific values; values can be added to specify a combination of behaviors.

Value Description
1 Overwrite  The import file silently overwrites the target should it already exist.
2 Don't create structure  By default, new structures are created. If Overwrite is not set, an alert asks the user for permission to overwrite.
4 Don't import data  By default, data is imported when a data document is used to create a schema.

Example

The following example imports an XML file representing a table called Invoices into the current database. Access overwrites the Invoices table if it already exists.

Application.ImportXML _
    DataSource:="C:\XMLData\Invoices.xml", _
    OtherFlags:=1