I'm hoping someone can help me understand why my code is not functioning correctly.
Here is the code:
Code:
Public Function XML_OutSendBtn_Click()
'export query to selected XML file
Dim ExportFileStr As String
Dim objAddress As AdditionalData
ExportFileStr = "C:\Users\Admin\Desktop\Test"
Set objAddress = Application.CreateAdditionalData
If Right(ExportFileStr, 4) <> ".xml" Then
ExportFileStr = ExportFileStr & ".xml"
End If
Set objAddress = objAddress.Add("EMPADDRESS")
objAddress.Add ("EMPADDRESS")
Application.ExportXML acExportQuery, "EMPLOYEE", ExportFileStr, , , , , , , objAddress
End Function
What happens is that I had to put the Employee Address query in twice "EMPADDRESS" for it to show up on the output XML file. I don't think that I should have had to resort to that for it to work. I'm calling this in a macro and the macro is being called by a command button on a form. I borrowed this code from another post that was solved last year.
Any suggestions would be appreciated.