How to Import .XML files as a table

  • Thread starter Thread starter Mota
  • Start date Start date
M

Mota

Hi;
There is no Constant "AcFormatXML" in AccessXP.How to send a table to a file
in .XML format through code?
In addition,when i use DoCmd.OutPutTo command,and leave the format argument
blank,and choose XML manually from the "Select Format" appearing dialogue
box,the field names and some other specifications are stored in a separate
file as Schema and i cant choose to merge this two files(I tried it but it
failed to save)
So,How to import this .XML file to my DB thru code?
Thank you so much in advance.
 
I don't know if it is possible to "Export" a table as XML from Access, but
ADO knows about XML and can export a table to an XML file from a access
table. Here is some "just barely tested" code with no error handling. It
did work one time :-)

Public Sub ExportTableAsXML(strTablename As String, strOutFilename As
String)
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open strTablename, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
rs.Save strOutFilename, adPersistXML
rs.Close
Set rs = Nothing
End Sub

On my system it created a file that looks like well formatted XML

Ron W
 
This document just shows How to Export/Import thru Access File menu,not thru
code.The thing we all know already.(This is prepared in year 2001)
Do u have any information on coding this action?
Thank you.
 
Back
Top