This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Exports data, schema, and/or presentation information for the specified Microsoft Access object as XML files.
expression.ExportXML(ObjectType, DataSource, DataTarget, DataTransform, SchemaTarget, SchemaFormat, SchemaTransform, PresentationTarget, PresentationTransform, ImageTarget, LiveReportSource, Encoding, OtherFlags)
expression Required. An expression that returns an Application object.
|AcExportXMLObjectType can be one of these AcExportXMLObjectType constants.|
DataSource Required String. The name of the Access object to export. The default is the currently open object of the type specified by ObjectType.
DataTarget Optional String. The file name and path for the exported data. If this argument is omitted, data is not exported.
DataTransform Optional String. The name of the XSL file to apply to the data before it is written to the target file.
SchemaTarget Optional String. The file name and path for the exported schema information. If this argument is omitted, schema information is embedded in the data document.
|AcExportXMLSchemaFormat can be one of these AcExportXMLSchemaFormat constants.|
SchemaTransform Optional String. The name of the XSL file to apply to the schema information before it is written to the target file.
PresentationTarget Optional String. The file name and path for the exported presentation information. If this argument is omitted, presentation information is not exported.
PresentationTransform Optional String. The name of the XSL file to apply to the presentation information before it is written to the target file.
ImageTarget Optional String. The path for exported images. If this argument is omitted, images are not exported.
LiveReportSource Optional String. Connection information for a report containing live data. This may be a reference to an .odc file or an XMLSQL request. This argument is ignored if ObjectType is not acExportReport.
|AcExportXMLEncoding can be one of these AcExportXMLEncoding constants.|
OtherFlags Optional Long. A bit mask which specifies other behaviors associated with exporting to XML. The following table describes the behavior that results from specific values; values can be added to specify a combination of behaviors.
|1||Related tables Includes the "many" tables for the object specified by DataSource.|
|2||Relational properties Creates relational schema properties.|
|4||Run from server Creates an ASP wrapper; otherwise, default is an HTML wrapper. Only applies when exporting reports.|
|8||Special properties Creates extended property schema properties.|
When the ExportXML method is called from within an Access object, the default behavior is to overwrite any existing files specified in any of the arguments. When the ExportXML method is called from within a data access page, the default behavior is to prompt the user before overwriting any existing files specified in any of the arguments.
The following example exports the table called Customers in the current database as XML. The data and schema are exported as separate files, and the schema is in XSD format. Existing files are overwritten.
Application.ExportXML _ ObjectType:=acExportTable, _ DataSource:="Customers", _ DataTarget:="Customers.xml", _ SchemaTarget:="CustomersSchema.xml", _ SchemaFormat:=acSchemaXSD, _ OtherFlags:=1