Bud Goss
bgoss711 at ameritech.net
Fri Jul 16 15:51:45 CDT 2010
This works with the Northwind database giving a two level xml table
Now I will try to use the method to create a four level xml table in my real world application
Thanks to Charlotte Foust and Darryll Collins for responding to my original post
Public Sub ExportRel()
' Purpose: Exports the Orders table as well as
' a number of related database to an XML file.
' XSD and XSL files are also created.
' Orig code from MSDN has syntax errors; see attempted fixes below.
' Make the Sub Public to can call from Immediate window.
Dim objAD As AdditionalData
' Create the AdditionalData object.
Set objAD = Application.CreateAdditionalData
' Add the related tables to the object.
With objAD
.Add "Order Details"
' objAD(Item:="Order Details").Add "Order Details Details"
objAD.Item("Order Details").Add "Order Details Details"
.Add "Customers"
.Add "Shippers"
.Add "Employees"
.Add "Products"
' objAD(Item:="Products").Add "Product Details"
objAD("Products").Add "Product Details"
' objAD(Item:="Products")(Item:="Product Details").Add _
' "Product Details Details"
' Try this to fix it:
objAD("Products").Item("Product Details").Add _
"Product Details Details"
.Add "Suppliers"
.Add "Categories"
End With
'Exports XML File to c:\FundXML2
Application.ExportXML ObjectType:=acExportTable, DataSource:="Orders", _
DataTarget:="C:\FundXML2\Test3_Northwind_Andy01.xml", _
AdditionalData:=objAD
MsgBox "ExportXML File Colmplete Complete"
End Sub