O'Reilly logo

Access Data Analysis Cookbook by Wayne S. Freeze, Ken Bluttman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Importing and Exporting Using XML

Problem

How do I save data from my database using an XML format? Also, how can I import XML-formatted data into my database?

Solution

To export an XML file, right-click on the name of the table or query you want to export, and choose Export from the context menu. Select the filename you want to use, and change the "Save as" type to XML. When you press the Export button, Access will display the Export XML dialog box (see Figure 7-14).

The Export XML dialog box

Figure 7-14. The Export XML dialog box

Make sure that only the Data (XML) checkbox is selected, and press OK to finish exporting your data. Access will generate a file similar to the one shown in Figure 7-15.

Data generated by the XML export process

Figure 7-15. Data generated by the XML export process

Tip

While Access normally saves only one table per file, if your Access database design includes Lookup fields, these tables will be exported as well.

To import an XML file, simply choose File → Get External Data → Import from Access' main menu, and then select the file containing your data. The Import XML dialog box will be displayed, containing the structure of your data (see Figure 7-16). Press OK to load the data into your database.

Discussion

When you export a table or query to XML, you'll see something like this (note that XML files can be opened and viewed with simple ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required