Importing / Exporting XML

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I wish to generate an XML file from a single table. Is there anything already in Access to do that or a VB function I can call? Also, I am going to want to import an XML file to. Is there anything in Access to do that – provided the XML tags match the Access record field names, and the data is going into one table

I am new to Access

Thanks
Mike P
 
A2003 handles XML very well. (They had more time to work on it.)
Support for XML gets worse as you go back in time.

So it depends on what version of Access you have.

Access imports its own exported XML data perfectly.
Other types of XML may work - I have not tried.

I wrote a VB function in A97 to do it.
Very complex but not impossible.

One more tip:

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

--
Joe Fallon
Access MVP



Mike P said:
Hello,

I wish to generate an XML file from a single table. Is there anything
already in Access to do that or a VB function I can call? Also, I am going
to want to import an XML file to. Is there anything in Access to do that -
provided the XML tags match the Access record field names, and the data is
going into one table?
 
-----Original Message-----
Hello,

I wish to generate an XML file from a single table. Is
there anything already in Access to do that or a VB
function I can call? Also, I am going to want to import
an XML file to. Is there anything in Access to do that
â?" provided the XML tags match the Access record field
names, and the data is going into one table?

Mike, all you need to do (in Access 2002, I never tried
this in earlier versions) is go to teh Tables or Query
page of the database window. Highlight the table/query you
want to convert to XML. Right-click and select Export (or
File/Export from teh menu). Pick a file name and folder,
and select the "XML Documents" file type option.

To import, use File/Import and specify the XML file you
want. It will create a table with the name of the XML doc
you imported. Yoiu may need to tweak the field
types/sizes, but that'll get you started.

Piece of cake!

HTH,

Terrell
 
Back
Top