Results 1 to 5 of 5
  1. #1
    steve2507 is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    12

    XML Import issues

    Hi,

    I'm trying to import/merge/update a table from an xml file.

    To import I'm using the following code:
    Code:
    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

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    I think you will have to import the records to a temporary table and then run UPDATE and INSERT sql actions on the primary with the temp table as source.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    steve2507 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    12
    Quote Originally Posted by June7 View Post
    I think you will have to import the records to a temporary table and then run UPDATE and INSERT sql actions on the primary with the temp table as source.
    Thanks for he reply, shall give it a go in the morning.

    With a temporary table does access automatically delete it?

    Thanks

    Steve

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    No, you would have to do that manually or with code. Or keep the table and reuse. Have code delete all records and then have the import append to that existing table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    steve2507 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    12
    Having the table kept and delete records will probably be the best idea for our needs.

    Thanks for the help.

    May be back when it comes to the update and insert bit, but prefer to have a go first.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Import from Excel to Access 2010 Issues
    By bcofie in forum Import/Export Data
    Replies: 7
    Last Post: 01-20-2014, 10:12 AM
  2. Query issues
    By admessing in forum Queries
    Replies: 25
    Last Post: 12-27-2011, 11:23 AM
  3. VBA debuggin issues....
    By sjl in forum Programming
    Replies: 1
    Last Post: 08-29-2011, 01:47 PM
  4. between query issues
    By jderrig in forum Queries
    Replies: 4
    Last Post: 01-15-2010, 02:30 PM
  5. Subform Issues
    By dromorkid in forum Forms
    Replies: 0
    Last Post: 11-24-2008, 11:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums