Export related tables to XML (code error)

D

ditimar

I got a code on the help of Microsoft but when I try to compile it give´s
the error message:
“Compilation Error: Argument not namedâ€
I added the references: Microsoft XML v5.0, Microsoft Data Access Components
Instaled Version, Microsoft Visual basic for Applications Extensibility 5.3,
Microsoft Access 11.0 Object Library

The code and the references are exposed above :
Please,somebody knows how can I resolve this problem?


Private Sub ExportRelTables()
' Purpose: Exports the Orders table as well as
' a number of related databases to an XML file.
' XSD and XSL files are also created.

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"
.Add "Customers"
.Add "Shippers"
.Add "Employees"
.Add "Products"
objAD(Item:="Products").Add "Product Details"
.Add "Suppliers"
.Add "Categories"
End With

' Export the Orders table along with the addtional data.
Application.ExportXML acExportTable, "Orders", _
"C:\Orders.xml", "C:\OrdersSchema.xsd", _
"C:\OrdersStyle.xsl", AdditionalData:=objAD
End Sub
 
M

MATT

ditimar said:
I got a code on the help of Microsoft but when I try to compile it give´s
the error message:
“Compilation Error: Argument not namedâ€
I added the references: Microsoft XML v5.0, Microsoft Data Access Components
Instaled Version, Microsoft Visual basic for Applications Extensibility 5.3,
Microsoft Access 11.0 Object Library

The code and the references are exposed above :
Please,somebody knows how can I resolve this problem?


Private Sub ExportRelTables()
' Purpose: Exports the Orders table as well as
' a number of related databases to an XML file.
' XSD and XSL files are also created.

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"
.Add "Customers"
.Add "Shippers"
.Add "Employees"
.Add "Products"
objAD(Item:="Products").Add "Product Details"
.Add "Suppliers"
.Add "Categories"
End With

' Export the Orders table along with the addtional data.
Application.ExportXML acExportTable, "Orders", _
"C:\Orders.xml", "C:\OrdersSchema.xsd", _
"C:\OrdersStyle.xsl", AdditionalData:=objAD
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top