Export Access data as XML
In Microsoft Access, you can output data to Extensible Markup Language (XML) by exporting to an XML document. You can also use a schema to specific the structure of the XML document as well as a style sheet to describe the presentation of the data.
Export a table, query, form, or report as XML
- In the Database window, click the name of the table, query, form, or report that you want to export, and then on the File menu, click Export.
- In the Save as type box, click XML Documents (*.xml).
- Click the arrow to the right of the Save in box, and select the drive or folder to export to.
- In the File Name box, enter a name for the file, and then click Export.
- In the Export XML dialog box, do one or more of the following:
- To export the data to an XML document, select Data (XML).
- To export the schema to an XML file, select Schema of the data.
- To format your table or query data by using an Extensible Style Language file, select Presentation of your data (XSL). Click the arrow to the right of the drop-down box and select an Access XML conversion option.
Note The Data check box must be selected for the Presentation of your data (XSL) drop-down box to be available.
- Click OK to export to the XML document.
Set advanced options for exporting XML files
- In the Export XML dialog box, click Advanced.
- Set options by doing one or more of the following:
Export data to XML
- Select the Data tab.
Note The Export data check box and Data format drop-down box show the selections made in step 5.
- Enter a destination for the exported files in the Export location dialog box or use the Browse button. The path can be to a hard disk drive or a universal naming convention (UNC) path on a server.
- If you are exporting from a table, only the data from the currently selected table is exported, by default. Click the Include related tables check box to export the currently selected table along with any related side tables.
- To select an encoding format other than the default, click the Encoding drop-down box and make a selection.
Export schema to XML
- Select the Schema tab.
Note The Export schema check box shows the selection made in step 5.
- To select a schema format other than the default, click the Schema format drop-down box and make a selection.
- To include additional information on the underlying structure of the database such as the relationship between multiple tables and primary and foreign key names, select the Include relational properties (data definition) check box.
- To embed the schema directly into the XML data document, select the Embed schema in exported XML data document option.
To create a schema file which is separate from the data file, select the Create separate schema document option, and enter a valid destination for the file or use the default.
Present your data
- Select the Presentation tab.
Note The Presentation format drop-down box shows the selection made in step 5.
- Do one of the following:
- To run the exported file from a client machine, select the Client (HTML) option under the Run from selection. This option generates an HTML file on the client machine which contains scripting code to merge the presentation (XSL) file and the data (XML) file. This option has the advantage of indirectly referencing the presentation file from the HTML file instead of embedding the presentation information in the data. Therefore, either the data (XML) file or presentation (XSL) file can be changed without having to rerun the original document.
- To run the exported file from a server, select the Server (ASP) option under the Run from selection. This option generates an ASP file that merges the presentation (XSL) information with the data (XML) and sends the resulting HTML file to the client machine for display.
- In order for images to appear correctly in an XML presentation, they must be located external to the XSL document which contains internal references to the files. Do one of the following:
- Select the Put images in option and the file location.
- Select the Don't include images option to exclude any document images from the XML version.
- Enter a destination for the exported presentation file in the Export location dialog box, or use the Browse button. The destination path can be to a hard disk drive or a universal naming convention (UNC) path on a server.