XML seems like a good solution for my problem, but none of Access' tools can handle the type of data I need to display. How can I build my own XML documents?
Included with Access 2003 is an external library that you can add to your VBA programs. It provides a complete set of objects that allow you to build a tree structure that will eventually form your XML file.
To use this library, you need to add it to your application. Choose Tools → References in the Visual Basic Editor to display the References dialog box (as shown in Figure 7-18), and select Microsoft XML, v5.0 from the list of references.
Figure 7-18. Adding Microsoft XML v5.0 to your application
There are several versions of the Microsoft XML library. As long as you choose v3.0 or later, it really shouldn't matter which version you use. I chose v5.0 because it's installed along with Access 2003/2007.
The following routine uses two objects from the Microsoft XML library: the
DOMDocument object, which provides the overall structure for the document, and the
IXMLDOMElement object, which stores the information for a single node.
When working with the objects from this library, you use the
New keyword to create an instance of the
DOMDocument object, and then you use the appropriate
Create method from the
DOMDocument object to create any other objects you need. Once you've created ...