Solved

Import XML file into existing table and update the record

Posted on 2014-10-04
1
430 Views
Last Modified: 2014-10-05
I have a XML and a XSD file on my desktop that I want to use to UPDATE an existing record in a table in my Access 2010 database.

What is the best way to achieve this?

--Steve
0
Comment
Question by:SteveL13
1 Comment
 
LVL 7

Accepted Solution

by:
Gauthier earned 500 total points
Comment Utility
http://msdn.microsoft.com/en-us/library/office/ff823157(v=office.14).aspx

The best way will depend on any integrity link from the table to update to the rest of your  database
Assuming we cannot temporarily delete that table or it's content, we have those solution:

BEST Solution (If you control the export process)
- Make the export/import from a temporary table copy you can delete safely.
step 1 Delete existing temporary table if it exists
step 2 Run the importXML with the parameter acStructureAndData.
step 3 Execute a simple update query.

If the table exist is the same name, cannot be deleted and the record to update also cannot be deleted beforehand:

importXML with acAppendData will fail (duplicate primary key)
importXML with acStructureAndData willproduce a new unknown to your code tablename.
you can work arround that in this way:

step 1 delete the importErrors (or count rows)
step 2 Make a list of existing table name.
step 3 Run the importXML with acStructureAndData
step 4 Compare current table name with earlier list.
step 5 Check the importErrors table.
step 6 Create an update query using the found name.
step 7 Run the update query
step 8 Delete the imported table.
step 9 Report any errors to the user.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

744 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

16 Experts available now in Live!

Get 1:1 Help Now