Exporting Information to a Text File


Text files are the lowest common denominator file format. Most applications can open, display, and save information in text format. The downside to text files is that they don't contain any formatting information, so they look consistently plain in all applications.

Depending on what type of content you are trying to export from a database, you may have the option to export the formatting and layout along with the data. If you select this option, the unformatted text will be arranged in the text file much as it is in the Access object. If you don't choose this option, the information will be saved as either delimited or fixed-length lines.

In this exercise, you will export a table from a database first as a formatted text file, and then as an unformatted text file.

USE the 05_ExportText database. This practice file is located in the Chapter04 subfolder under SBS_Access2007.

OPEN the 05_ExportText database, then open the Shippers table in Datasheet view.


1.

On the External Data tab, in the Export group, click the Text File button.

2.

In the Export Text File wizard, click Browse. In the File Save dialog box, navigate to the Documents\MSP\SBS_Access2007\Chapter04 folder, change the default file name from Shippers.txt to Shippers_delim.txt, and then click Save.

3.

Select the Export data with formatting and layout check box. Then select the Open the destination file after the export operation is complete check box.

4.

In the Export Text File wizard, click OK.

The Encode As dialog box opens. From here you can select the encoding format options you want.

5.

With the Windows option selected, click OK.

Access exports the table as a formatted text file. Your default text editor displays the Shippers_delim text file.

Notice that ASCII characters have been used to separate the rows and columns in the table.

6.

Close the text file and the Export Text File wizard.

7.

Repeat Steps 1 through 4 to export the table again, but this time change the name to Shippers_fixed.txt, and don't select the Export data with formatting and layout and Open the destination file after the export operation is complete check boxes.

The Export Text wizard starts. This will guide you through the process of setting various options. At any point in the wizard, you can click Finish to accept the default selection for all remaining options.

Tip

You can move forward and backward through this wizard by clicking the Next and Back buttons. You can experiment with different options and move along as far as the last page before backing up and trying a different option.

8.

With the Delimited option selected, click Next.

The options on this page are different depending on whether you are exporting a delimited or fixed-width file.

9.

With the Comma option selected, click Finish.

Access exports the table as an unformatted text file. You can use Windows Explorer to navigate to where you saved the Shippers_fixed text file and double-click it to open it in your default text editor.

CLOSE the two Shippers text files, the Export Text wizard, and the 05_ExportText database.




MicrosoftR Office AccessT 2007 Step by Step
MicrosoftR Office AccessT 2007 Step by Step
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 127

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