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
charmedimsureAsked:
Who is Participating?
 
pteranodon72Connect With a Mentor Commented:
Just use Access's current Application object


Function ImportXML()

Const acAppendData = 2

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

End Function

HTH,

pT
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.