Procedure to Import an XML File

Posted on 2008-11-14
Last Modified: 2013-11-27
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
Question by:charmedimsure
    1 Comment
    LVL 14

    Accepted Solution

    Just use Access's current Application object

    Function ImportXML()

    Const acAppendData = 2

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

    End Function



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now