My Assistant
![]() ![]() |
|
|
Feb 23 2012, 03:23 PM
Post
#1
|
|
|
New Member Posts: 6 |
Hi,
I'm trying to import/merge/update a table from an xml file. To import I'm using the following code: QUOTE Private Sub Command0_Click() Const acAppendData = 2 Set objAccess = CreateObject("Access.Application") objAccess.OpenCurrentDatabase "DATABASE LOCATION" objAccess.ImportXML "HTTP OF XML FILE", acAppendData End Sub This works perfectly to import new records, however what I also need it to do is merge/update the data. So the xml file will contain the correct data and any amendments need to be made to the Access table. Any help greatly appreciated. Steve PS I'm using Access 2010 |
|
|
|
Feb 23 2012, 04:11 PM
Post
#2
|
|
|
UtterAccess VIP / UA Clown Posts: 25,212 From: LI, NY |
I would import the file to a temp table, then run an Update query that links the two and an Append query.
|
|
|
|
Feb 23 2012, 05:01 PM
Post
#3
|
|
|
New Member Posts: 6 |
Thanks for the reply.
That sounds like the sort of way to go. With the temp table can Access be set to create it then delete it? As this import needs to be carried out regularly. Thanks Steve |
|
|
|
Feb 24 2012, 07:55 AM
Post
#4
|
|
|
UtterAccess VIP / UA Clown Posts: 25,212 From: LI, NY |
Sure, You can use DoCmd.DeleteObject.
And then use a MakeTable query to create it. But if the structure will always be the same, it may be better to leave the table and delete all records before the Append. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 19th June 2013 - 11:40 PM |