Exporting data to xml file

  • Thread starter Thread starter Raul Sousa
  • Start date Start date
R

Raul Sousa

I need a button to export the result of an access query to an xml file.
This exported xml file must meet a predefined schema.
Is there a way access can export information meeting a predefined xml schema?
I have already searched for a solution. Based on my findings I created this
code, to export the data.
Private Sub Comando0_Click()
Dim fXMLPath As String
fXMLPath = "C:\Users\Raul\Documents\testxml.xml"
ExportXML acExportQuery, "testquery", fXMLPath
End Sub
I thought to export the data first, with any particular schema. After that I
will try to meet the given schema.
The problem with this code is that it does not export any data. This is the
result:
<?xml version="1.0" encoding="UTF-8" ?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata"
generated="2008-03-10T18:34:31" />

Any ideas why is it not exporting data?
Does anyone have a better solution?
 
Hi Raul,

Take a look at the query - does it contain data? Your output looks a lot
like what an 'empty' recordset export produces.

Just in case it requires fully qualified syntax...

Try restating your export line this way...

Application.ExportXML ObjectType:= acExportQuery, DataSource:="testquery",
DataTarget:=fXMLPath

Hope this helps,
Gordon
 
Hello,
Thank you for your reply.
My query contains data. it contains 3 results. i choose a smal query for
this test.

I tried to restat it like you sugested, but it produced the same result.


"gllincoln" escreveu:
 
Fedor is eager, but he needs to consistently oppose major opponents, and in past period he hasn't through that.But in any event, it now silkroad gold[/url:2rga7bsv] appears credible that Fedor give promote for Envisage on New Assemblage's Eve, and not for Affliction in January. So where does Affliction go fro (http://www.ugamegold.com/silkroad-online-gold/:2rga7bsv)?
 
Back
Top