Forum Discussion
Problems Importing XML Files Into Access
I'm trying to import several XML files into Microsoft access. When I use the XML import wizard however, access imports the XML file creating multiple tables, rather than a single table where each record in the table is from one of the XML files. Is there a way to import an XML file into a single table, rather than it creating multiple tables?
- George_HepworthSilver Contributor
Please clarify what, exactly, you need to work with, one XML file or multiple XML files.
"...access imports the XML file"
"... each record in the table is from one of the XML files"
- JBLT-77Iron ContributorI have multiple xml files I need to import. They import the data into the same tables, but that’s the problem access thinks that the xml fields should be a table instead importing them as columns to a single table.
- arnel_gpSteel Contributoron the First import it will create the table.
on second and succeeding import there is an Option to import on Same table.
- tsgiannisIron ContributorIf you want total control with XML you need to do it via code.
Something like that
Set xmlDoc = New MSXML2.DOMDocument
intFile = FreeFile()
Open strXMLFilename For Input As intFile
strXMLFile = input$(LOF(1), 1)
Close intFile
Set xmlDoc = CreateObject("MSXML2.DOMDocument.6.0")
xmlDoc.LoadXML strXMLFile
Then you will iterate its nodes..grab the values and place them accordingly - helgetelefonmannCopper Contributor
Try using XSL transformation. To generate one, you can try https://www.easycodeforall.com/XSLTCode.jsp and enter your current and desired XML formats there. The generator will output the appropriate XSLT, which you can use when clicking the "Transformation"-Button in the Access Import Wizard.