Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Must Export from Access to XML and Include One-To-Many Relationships

Status
Not open for further replies.

Ross1

Programmer
Feb 14, 2002
20
US
I need to export data from an Access (or SQL Server) database into an XML file with very specific syntax.
The reason for the exact syntax is that the folks receiving the XML file will use it to upload data into their system and the syntax must match exactly.

I have a table called FD. FD stands for Facilities Data, and this is the parent, or one side, of a one-to-many. I also have a table call ProductTypes, which contains the products that can be related to each facility in the table FD. Each Facility in FD can have one or more products in the ProductTypes table.

I need to export this data into XML and it needs to look just like this:
<?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?>
<FacilityData BranchCode=&quot;ANT&quot; NumberRows=&quot;1&quot; ExportDate=&quot;2003-01-01&quot;>
<FD>
<FacilityID>fac12345</FacilityID>
...
<ProductTypeList>
<ProductType>LVNR</ProductType>
<ProductType>LVRV</ProductType>
<ProductType>LFNR</ProductType>
<ProductType>ABCD</ProductType>
</ProductTypeList>
...
</FD>
</FacilityData>

How do I setup my data in ACCESS to get the ProductType tags to nest under the ProductTypeList tags (as shown above) when I export it?

If necessary, I can move my data over to SQLServer2000 if that would make this transfer easier.

Thanks for any help you can provide.



 
I would write a procedure in VBA to open the db and create the file on the fly...You can create the basic query and then walk thru the result set and write out what you need to the XML file as you go

Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top