Hi,
I have been searching around for the best way to do this and I need some insight. I have a file folder where pre-structured XML files full of form data are being constantly dumped to. I am curious as to what is the best way to import the data from the XML file into an access database table.
The database I am working with has one large main table where all of the main record data is stored. There is a somewhat complex string of queries and reports based off this table that I am concerned about preserving. The problem is that the XML file is not structured in the same way the table is. The headings are named different, aren't in the same order, etc. I cannot use the import method and simply append it to the main table.
After much searching around I have found two options:
1) Use the built in XML import method that access provides to create a secondary table. Then find a way to take data from individual fields in the second table and map and insert it into a new record in the main table.
2) Read the data from the XML file all at once and then map and insert it into the main table
So.. which would be better/easiest to automate (most likely via button click on a form)? I only have a small understanding of VBA and even less understanding of anything XML. If anyone could point me to some sample code or outline the process I would greatly appreciate it. Hope I explained things okay.
I have been searching around for the best way to do this and I need some insight. I have a file folder where pre-structured XML files full of form data are being constantly dumped to. I am curious as to what is the best way to import the data from the XML file into an access database table.
The database I am working with has one large main table where all of the main record data is stored. There is a somewhat complex string of queries and reports based off this table that I am concerned about preserving. The problem is that the XML file is not structured in the same way the table is. The headings are named different, aren't in the same order, etc. I cannot use the import method and simply append it to the main table.
After much searching around I have found two options:
1) Use the built in XML import method that access provides to create a secondary table. Then find a way to take data from individual fields in the second table and map and insert it into a new record in the main table.
- I already have the import part of this option working. The only part I can't seem to understand is how to take data from the second table and get it into a new record in the main table under the correct headings
2) Read the data from the XML file all at once and then map and insert it into the main table
- I have not attempted this yet. I was having a hard time understanding how to retrieve the data from the XML file in the first place.
So.. which would be better/easiest to automate (most likely via button click on a form)? I only have a small understanding of VBA and even less understanding of anything XML. If anyone could point me to some sample code or outline the process I would greatly appreciate it. Hope I explained things okay.