Microsoft Access (2010) was unable to export data using export query for xml (1 Viewer)

hoychep

New member
Local time
Yesterday, 21:39
Joined
Jun 11, 2014
Messages
7
Hi I am trying to use ExportXML Method in MS Access for exporting a query with a user input using forms.

I get the error:

Run - time error '31532'
Microsoft Access was unable to export the data


This is the code that I used.

Private Sub Command9_Click()
Application.ExportXML ObjectType:=acExportQuery, DataSource:="eparcelorder", _
DataTarget:="C:\XML\" + tmpWorkOrderNo.Caption + ".xml", _
WhereCondition:="dbo_eParcel.workorderno = '" & Forms!frmMainForm![tmpWorkOrderNo].[Caption] & "'"
End Sub


Is there any limitations in MS Access 2010 that prevents exporting data when it asks user input or using criteria?

Thank you in advance for your help! I've been working on this for a week and it is a very simple function :banghead:
 

spikepl

Eledittingent Beliped
Local time
Today, 05:39
Joined
Nov 3, 2010
Messages
6,144
What have you tried and with what outcome?
 

hoychep

New member
Local time
Yesterday, 21:39
Joined
Jun 11, 2014
Messages
7
Hi,

I've tried putting an input from my form and after clicking the button access is prompting me an error. I am expecting that the xml that will be generated will be based on the data from my query after clicking the button. Whenever I click the button, I am getting an error of "Run - time error '31532'
Microsoft Access was unable to export the data".
 

hoychep

New member
Local time
Yesterday, 21:39
Joined
Jun 11, 2014
Messages
7
Hi,

I've tried putting an input from my form and after clicking the button access is prompting me an error. I am expecting that the xml that will be generated will be based on the data from my query after clicking the button. Whenever I click the button, I am getting an error of "Run - time error '31532'
Microsoft Access was unable to export the data".
 

rathbst

New member
Local time
Today, 15:39
Joined
Mar 1, 2015
Messages
1
Hi Guys,

I use the attached to produce a 3 million line nested xml in about five minutes.

There are two key items,

1) a simple piece of VB,


Public Function Export_ListingData()

Dim objOtherTbls As AdditionalData

On Error GoTo ErrorHandle
Set objOtherTbls = Application.CreateAdditionalData
objOtherTbls.Add "ro_address"
objOtherTbls.Add "ro_buildingDetails"
objOtherTbls.Add "ro_businessDetails"
objOtherTbls.Add "ro_businessExtras"
objOtherTbls.Add "ro_businessExtrasAccounts"
objOtherTbls.Add "ro_businessExtrasAccom"
objOtherTbls.Add "ro_businessExtrasAccom2"

Application.ExportXML ObjectType:=acExportTable, _
DataSource:="ro_business", _
DataTarget:="C:\Users\Steve\Documents\Conversions\ListData.xml", _
AdditionalData:=objOtherTbls
Exit_Here:
MsgBox "Export_ListingData completed"
Exit Function
ErrorHandle:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Here
End Function


2) Linking the tables in relationship manager using joins from primary to FOREIGN keys.

If there are no relationships the code will produce a sequential xml file, if there are
relationships between primary keys you will get a 31532 error and the data export will fail.

Kind Regards

Steve
 

Users who are viewing this thread

Top Bottom