Cycle through reports and export to XML

K

kw_uh97

Hello Everyone

I was searching on the discussion board for code that would cycle through a
databases objects (Reports in particular) and have these reports exported as
XML files. I found some code that I thought would accomplish my task. I then
modified if to cycle through reports but I keep getting the error when I
attempt to run it. "The expression that you entered refers to an object that
is closed or does not exist."

Here is my code:

Public Sub ExportToXML()

Dim aob As AccessObject
Dim rpt As Report


Dim sRpt As String, sXML As String, sXSL As String



For Each aob In CurrentProject.AllReports

sRpt = "Reports(aob.Name)"
sXML = "C:\tmp\" & aob.Name & ".xml"
sXSL = "C:\tmp\" & aob.Name & ".xsl"
iFrmt = 0 'ASP format (use 0 for HTML output)

ExportXML acExportReport, sRpt, sXML, , sXSL, , , iFrmt
Next aob

End Sub

Please review and provide guidance if you can. Thanks In Advance for you help.

kw_uh97
 
K

kw_uh97

Hello All:

I figured it out myself and here is the code.

Public Sub ExportToXML()

Dim aob As AccessObject
Dim rpt As Report


Dim sRpt As String, sXML As String, sXSL As String



For Each aob In CurrentProject.AllReports

sRpt = aob.Name
sXML = "C:\tmp\" & aob.Name & ".xml"
sXSL = "C:\tmp\" & aob.Name & ".xsl"
iFrmt = 0 'ASP format (use 0 for HTML output)

ExportXML acExportReport, sRpt, sXML, , sXSL, , , iFrmt
Next aob

End Sub

Thanks Again
kw_uh97
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top