将多个访问表导出到单个XML [英] exporting multiple access tables to single XML
问题描述
我有多个Microsoft Access表,我想将它们导出到单个XML文件中.如何将表的顺序和层次结构操纵成所需的XML结构?本质上,我希望能够逆向导入XML过程,该过程会自动将数据分解为多个表.我可以使用VBA,SQL和任何内置的导出功能.
I have multiple Microsoft Access tables that I want exported into a single XML file. How do I manipulate the order and hierarchy of the tables into the XML structure that I want? In essence, I want to be able to reverse the import XML process, which automatically breaks down the data into multiple tables. I can use VBA, SQL, and any built-in export function at my disposal.
推荐答案
我使用附件在大约五分钟的时间内生成300万行嵌套的xml.
I use the attached to produce a 3 million line nested xml in about five minutes.
有两个关键项目,
1)一个简单的VB,
1) a simple piece of VB,
Public Function Export_ListingData()
Dim objOtherTbls As AdditionalData
On Error GoTo ErrorHandle
Set objOtherTbls = Application.CreateAdditionalData
objOtherTbls.Add "ro_address"
objOtherTbls.Add "ro_buildingDetails"
objOtherTbls.Add "ro_businessDetails"
objOtherTbls.Add "ro_businessExtras"
objOtherTbls.Add "ro_businessExtrasAccounts"
objOtherTbls.Add "ro_businessExtrasAccom"
objOtherTbls.Add "ro_businessExtrasAccom2"
Application.ExportXML ObjectType:=acExportTable, _
DataSource:="ro_business", _
DataTarget:="C:\Users\Steve\Documents\Conversions\ListData.xml", _
AdditionalData:=objOtherTbls
Exit_Here:
MsgBox "Export_ListingData completed"
Exit Function
ErrorHandle:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Here
End Function
2)使用从主键到FOREIGN键的联接在关系管理器中链接表.
2) Linking the tables in relationship manager using joins from primary to FOREIGN keys.
如果没有关系,则代码将生成一个顺序的xml文件(如果存在) 主键之间的关系会出现31532错误,并且数据导出将失败.
If there are no relationships the code will produce a sequential xml file, if there are relationships between primary keys you will get a 31532 error and the data export will fail.
这篇关于将多个访问表导出到单个XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!