Exporting Table Data as Text Files

Exporting a table involves a sequence of operations similar to importing a file with the same format. To export a table as a comma- or tab-delimited file that you can use as a merge file with a variety of word-processing applications, complete these steps:

  1. graphics/table_wizard.gif Select the table you want to export in the Database window, and choose File, Export to open the Export Table 'Tablename' To dialog.

  2. Select Text Files (*.txt;*.csv;*.tab;*.asc) in the Save as Type drop-down list. Use the Save In drop-down list to select the drive and folder in which you want to store the exported file, type a name and extension for the exported file in the Filename text box, and then click Save to start the Text Export Wizard.

    Note

    Using the Text Export Wizard, including its advanced options, is the same as using the Import Text Wizard described in the "Importing Text Files" section earlier in the chapter, except that the result is an external text file instead of an Access table. You save and reuse export specifications by the method described for import specs.

    When exporting a text file, the Text Export Wizard doesn't have a step to edit field names or select field data types; these options aren't relevant when exporting data.

  3. Follow the procedures as though you were importing a text file. Figure 8.66 shows the Customers table exported as a tab-separated text file from the Northwind.mdb database and displayed in Windows Notepad.

    Figure 8.66. The two highlighted records of tab-separated text file demonstrates the problem that arises when fields contain newline pairs to, for instance, create multiline display of address data.

    graphics/08fig66.jpg

Caution

The two highlighted lines in Figure 8.66 are a single record from the Access table that was split into two text records during the export process. A newline pair is included in the Address field of the record for Consolidated Holdings. The purpose of the newline pair is to separate a single field into two lines: Berkeley Gardens and 12 Brewery. Use of newline pairs within fields causes many problems with exported files. Use of embedded newline pairs in text fields is a bad database design practice. Use two address fields if you need secondary address lines.


The records in files created by Access are exported in the order of the primary key. Any other order you might have created is ignored. If you don't assign primary-key fields, the records are exported in the sequence in which you entered them into the table.



Special Edition Using Microsoft Office Access 2003
Special Edition Using Microsoft Office Access 2003
ISBN: 0789729520
EAN: 2147483647
Year: 2005
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net