CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2002
    Posts
    72

    XML Import/Export

    Is there a way to save multiple tables of an MS Access database to a single XML file through VB code. My goal is to be able to email one XML file containing records of several tables and for the end user to be able to import this XML file into their access database through VB code. Thanks.

  2. #2
    Join Date
    Jul 2004
    Posts
    21
    it very difficult that you want to do that with xml
    maybe using base64 code is able to accomplish it

  3. #3
    Join Date
    Apr 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    1,792
    Its actually very easy - MS have a good article on msdn here - all you have to do is create a variable, turn it into an XMLDOMDocument, then append all the nodes from doing the rs.save <varName>, adpersistxml

    Unfortunately I can't give you the code cos its all work related here.
    Be nice to Harley riders...

  4. #4
    Join Date
    May 2009
    Posts
    1

    Re: XML Import/Export

    Hi - I found this thread seeking the same type of solution. Have found an apprently very neat solution - only a few lines of code. Goes thus:

    Dim AdditionalExportTables As AdditionalData
    Set AdditionalExportTables = Application.CreateAdditionalData
    AdditionalExportTables.Add ("tbl20Clients")
    AdditionalExportTables.Add ("tbl20POP")
    AdditionalExportTables.Add ("tbl40Meters")
    AdditionalExportTables.Add ("tbl41Readings")
    AdditionalExportTables.Add ("tbl10Scenarios")

    AdditionalExportTables.ExportXML ObjectType:=acExportTable, _
    DataSource:="tbl10Reports", _
    DataTarget:="" & CurrentProject.Path & "\SurveyData.xml", _
    AdditionalData:=AdditionalExportTables

    Probably not as elegant as Twodogs' solution but I thought I'd post as I'm not restricted by my employer in my ability to post code.

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured