Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

Procedure to Import an XML File

I have an Access Database.  When I manually do an import of an XML File it creates a Table named Form1 with all of the data

The procedure below works but I do not need it to reopen the datbase since I am making the call to import in the database where I want the data.  In other words I am calling this from my Practice Database located on C:\

How can I modify this code so it does not need to reopen the database?  Thanks

Function ImportXML()

Const acAppendData = 2

Set objaccess = CreateObject("Access.Application")
objaccess.OpenCurrentDatabase "C:\Practice.mdb"

objaccess.ImportXML c:\11-14NoTablesALL_data.xml", acAppendData

End Function
1 Solution
Just use Access's current Application object

Function ImportXML()

Const acAppendData = 2

Application.ImportXML "c:\11-14NoTablesALL_data.xml", acAppendData

End Function



Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now