CreateAdditionalData 方法

此頁沒有內(nèi)容條目
內(nèi)容

創(chuàng)建 AdditionalData 對象,該對象可用于向由 ExportXML 方法導(dǎo)出的父表添加附加的表和查詢。返回 AdditionalData

expression.CreateAdditionalData()

expression     必需。返回 Application 對象的表達式。

示例

下例將 Northwind Traders 示例數(shù)據(jù)庫的 Customer 表的內(nèi)容連同 Orders 和 Orders Details表內(nèi)容一起導(dǎo)出為名為 Customer Orders.xml 的 XML 數(shù)據(jù)文件。

Sub ExportCustomerOrderData()

    Dim objOrderInfo As AdditionalData

    Set objOrderInfo = Application.CreateAdditionalData()

    ' Add the Orders and Order Details tables to the data to be exported.

    objOrderInfo.Add "Orders"

    objOrderInfo.Add "Order Details"

    ' Export the contents of the Customers table. The Orders and Order

    ' Details tables will be included in the XML file.

    Application.ExportXML ObjectType:=acExportTable, DataSource:="Customers", _

                          DataTarget:="Customer Orders.xml", _

                          AdditionalData:=objOrderInfo

End Sub