简体   繁体   English

MS Access创建XML

[英]MS Access to create XML

I have a sample file from a customer and need to match the schema with data from various tables in my MS Database. 我有一个来自客户的样本文件,需要将架构与MS数据库中各个表中的数据进行匹配。

Tried writing a query and exporting the XML but it oversimplifies the XML and assumes that each row from the query is a single node and all the data elements fall under each instance of that node. 尝试编写查询并导出XML,但它过分简化了XML,并假定查询中的每一行都是单个节点,并且所有数据元素都属于该节点的每个实例。

Is there a way to setup a schema (possibly build it by importing my sample file) and then map fields to that for the export? 有没有办法设置模式(可能是通过导入示例文件来构建),然后将字段映射到该模式以进行导出?

I'm open to using Excel if by chance it is better suited - just figured the access relationships would be better. 如果有机会更适合我,我愿意使用Excel-只是认为访问关系会更好。

Perhaps you are looking for something like: 也许您正在寻找类似的东西:

Sub ExportCustomerOrderData()

    Dim objOrderInfo As AdditionalData

    Dim objOrderDetailsInfo As AdditionalData



    Set objOrderInfo = Application.CreateAdditionalData



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

    Set objOrderDetailsInfo = objOrderInfo.Add("Orders")

    objOrderDetailsInfo.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

From: http://msdn.microsoft.com/en-us/library/ff193212.aspx 来自: http : //msdn.microsoft.com/zh-cn/library/ff193212.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM