Library to Export tables as XML

kc1

Registered User.
Local time
Today, 14:04
Joined
Sep 22, 2008
Messages
23
Hi

I using the CreateAdditionalData method of exporting multiple tables as XML,

What reference(s) do I need to add?

Thanks
KC
 
see this:

Sub ExportXML(ObjectType As AcExportXMLObjectType, DataSource As String, [DataTarget As String], [SchemaTarget As String], [PresentationTarget As String], [ImageTarget As String], [Encoding As AcExportXMLEncoding = acUTF8], [OtherFlags As AcExportXMLOtherFlags], [WhereCondition As String], [AdditionalData])


Application.ExportXML

the function is in Access, no need to reference to other library.
 
You shouldn't need to add any additional references. I would ask which version of Access you are using. Can you show your complete code.

An example is shown below:

Sub ExportCustomerOrderData()
Dim objOrderInfo As AdditionalData
Set objOrderInfo = Application.CreateAdditionalData()
' Add the Orders and Order Details tables to the data to be exported. objOrderInfo.Add "Orders"
objOrderInfo.Add "Order Details"
' Export the contents of the Customers table. The Orders and Order
' Details tables will be included in the XML file.
Application.ExportXML ObjectType:=acExportTable, DataSource:="Customers", _ DataTarget:="Customer Orders.xml", _ AdditionalData:=objOrderInfo
End Sub
 
I'm using 2003 (company won't upgrade).
My code is very similar to what you posted.
The compile error is flagging up this line
Dim "objOtherTables as additionaldata"
 
Does your code actually have speech marks, if so remove them, else post all the code you are using, I can check it with a 2003 machine.
 
Does your code actually have speech marks, if so remove them, else post all the code you are using, I can check it with a 2003 machine.

'Private Sub btnExportXML_Click()
Dim objOtherTbls As additionaldata

Set objOtherTbls = Application.CreateAdditionalData
'Identify the tables or querys to export
objOtherTbls.Add "internet"
objOtherTbls.Add "mokaleme"
'Here is where the export takes place
Application.ExportXML ObjectType:=acExportTable, DataSource:="internet", DataTarget:="C:\myxml.xml", additionaldata:=objOtherTbls
MsgBox "Export operation completed successfully."'
 
I have just simulated your code in Access 2003 and it worked fine here is the copy of the code I ended up with. I placed it in a module sheet and used the same table name as yours but didn't see why you did a second objOthersTbls.Add which might have overwritten the other.

Code:
  Sub expXml()
  Dim objOtherTbls As AdditionalData
  Set objOtherTbls = Application.CreateAdditionalData()
  objOtherTbls.Add "internet"
  'Here is where the export takes place
  Application.ExportXML acExportTable, "internet", "C:\Access\MyXml.xml", AdditionalData:=objOtherTbls
   
  End Sub
 
I have just simulated your code in Access 2003 and it worked fine here is the copy of the code I ended up with. I placed it in a module sheet and used the same table name as yours but didn't see why you did a second objOthersTbls.Add which might have overwritten the other.

Code:
  Sub expXml()
  Dim objOtherTbls As AdditionalData
  Set objOtherTbls = Application.CreateAdditionalData()
  objOtherTbls.Add "internet"
  'Here is where the export takes place
  Application.ExportXML acExportTable, "internet", "C:\Access\MyXml.xml", AdditionalData:=objOtherTbls
 
  End Sub

Thanks, please could you tell me what Rferences you have checked?
I have Mircosoft XML, 6.0 checked.
 
I have no additional references checked, you shouldn't need to add any with this code. What happens if you remove the reference you checked.
 
I have no additional references checked, you shouldn't need to add any with this code. What happens if you remove the reference you checked.
Same error as before

Complile error:

User Defined type not defined
 
Then the only thing I can suggest is strip down a copy of your database (remove any sensitive data) and upload a copy into your thread.
 
Thanks for your help
I built a new database and the code now works.
 

Users who are viewing this thread

Back
Top Bottom