Export to XML

  • Thread starter Thread starter Leslie Isaacs
  • Start date Start date
L

Leslie Isaacs

I am using A2K, and need to export data as an XML file. Is
there a (reletively!) simple way to do this - I don't have
XML experience?
Thanks
Les.
 
Hi Leslie,

As far as I can remember XML support began with Access 2002. So the
simplest approach may just be to upgrade to Access 2003 (where it's much
improved).

Otherwise, there may be some third party software out there. Otherwise,
it's not that a big programming job to write VBA code that generates a
simple XML file from a particular table or query.
 
XML files can be easily created using Microsoft's ADO Recordset object and
saving it as an XML file. The sample code below shows how an Access 2000
query can be opened and saved as an XML file.

Sub SaveQueryToXMLFile(qryName As String)
Dim conn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Set conn = Application.CurrentProject.Connection
With rst
.Open qryName, conn, adOpenDynamic, adLockOptimistic
.Save "c:\Folder1\Folder2\" & qryName & ".xml", adPersistXML
.Close
End With
End Sub
 
Back
Top