Post Your Computer Questions

Site Index   |  Quick Index   |  New Tips   |  MS Windows   |  MS Office   |   Newsletter   |   Q&A  |   More Tips  |    

Tips Download   |   Donations   |   Customer Support   |   Registry Tips   |   Weekend Windup |   IE 6.0   |   IE 7.0  |   Help   |   Suggestions

 Windows XP Run Commands | Computer Questions. Microsoft Access Databases | Computer Terms | New Home Material Estimating Spread Sheets!

  Windows XP Remote Desktop Setup One! | 57 Vista Run Commands | Windows XP Remote Desktop Setup Two!


Using ADO to exchange data as XML (Access 97/2000/2002)

As you may know, Access 2002 natively supports XML, but earlier versions do not. However, you technically can import data into older versions of Access as well. Although you may work with the Recordset object's Open method frequently, it isn't well known that the Open method in ADO 2.1 and above allows you to specify the name of an XML file to import.

The only catch is, without getting into the technical details, the structure of the XML files ADO can work with is less common than what you'll find in the majority of XML files you're likely to come across. While you can create custom procedures that import the more common XML files into older versions of Access, ADO's methods are the easiest to work with. So, if the application storing the original source data supports ADO, you're in luck because you can simply create the XML using the Recordset object's Save method.

To create a compatible XML file using ADO, first create a Recordset object based on the data you want to export. Then use the Save method, which uses the syntax:

recordset.Save Destination, PersistFormat

The Destination argument specifies the name of the XML file to create and the PersistFormat argument should be set to the intrinsic constant adPersistXML. For example, your code might resemble:

rstExport.Save "C:\SourceData.xml", adPersistXML

To open the persisted recordset in Access, ensure that you have a reference to the ADO 2.1 library (or higher). Then, create a new Recordset object and use the Open method in the form:

recordset.Open FileName, "PROVIDER=MSPersist;", , , adCmdFile

Simply replace the FileName argument with the name of the appropriate XML file, as in:

rstImport.Open "C:\SourceData.xml", "PROVIDER=MSPersist;", , , adCmdFile

Once opened, you can work with the recordset as you would any other, so you could create a new table based on the data or build a procedure to append the information to an existing table.

<<<Back Home Next>>>






Main Site Navigation:

|Windows 7 Questions. |Vista Questions. |Windows XP Home and Pro Questions. |Internet Explorer 8.0 |Internet Explorer 7.0 |Printer Problems. |Outlook Express 6.0 |

|Windows Mail. |Moderator Tips! |Firefox |Home Networking Problems!! | Function Keys, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12 | Windows Live Essentials 2011.


You Can also get all these tips plus more in one Package including 100 Vista Tips!


Page 1

Page 2

Page 3

Page 4

Page 5

Page 6

Page 7

Page 8


See The 11 Tip Package That You Should Print And Keep Close To Your Computer! 

100 Vista Tips!

This One Also Comes With The Standard Tips Package!  2 Downloads!

  My Blog!

Close To 400 More XP Tips.  If you Can't Find The Answer Here just Click Here!
Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8

Newsletter Signup
   |   Search   |   Windows Versions   |   Office Versions   |  
Forum |   Readers Q&A   |   Tips In Full Graphics   |   Tips Download    

 Site Navigation:
   |   Support   |   Registry Tips   |   Weekend Windup   |   PC Questions |   IE 6.0   |   IE 7.0   |   Outlook Express 6.0   |   PC Help
Virus Info
   |   Computer Drivers   |   Hardware Info.   |  
Your Suggestions |   IE 7.0 Install  |   Database Downloads   |   Home  |  Computer Terms  

|   57 Vista Run Commands   |   Windows XP Run Commands  |   Microsoft Access Databases  |

Windows XP Remote Desktop Setup One! |New Home Material Estimating Spread Sheets! Windows XP Remote Desktop Setup Two!

All products mentioned are registered trademarks or trademarks of their respective companies.
Questions or problems regarding this web site should be directed to the
Copyright 1999-2011  Internet Fixes. All rights reserved.      
Legal Disclaimer

This Site Is Part Of The Internet Fixes Network!