Chapter 10. Working with External Data


  • Importing and exporting comma-delimited and fixed-width text files

  • Importing and exporting dBASE, Paradox, and Lotus 1-2-3 files

  • Importing and exporting XML and HTML files

In the previous chapter, you learned how to work with text files, using one old method and two new ones. For some types of text files, you can also use methods of the Access Application object for importing and exporting text files when working with data in VBA code. The TransferText method has been used to import data from (or export data to) comma-delimited or fixed-width files since the early days of Access, and it is still useful in Access 2007, when you are working with files in these formats. In Office XP, the TransferText method was updated to also export to and import from HTML files.

Typically, comma-delimited or fixed-width files are produced by mainframe computers, and you may need to import these files into your Access tables or export data from Access tables to comma-delimited or fixed-width files for import into mainframe applications. Additionally, you can use these formats to export data to or import data from other applications whose formats aren't directly supported by Access.

If you have data in Excel or Lotus spreadsheets, you can use the TransferSpreadsheet method to import data from them or export data to spreadsheets. And the TransferDatabase method can be used to transfer data between Access tables and legacy databases or spreadsheets.

These ...

Get Access™ 2007 VBA Bible: For Data-Centric Microsoft® Office Applications now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.