Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: How to Export Numeric Data with Quotation Marks and Commas


View products that this article applies to.

This article was previously published under Q208497
Novice: Requires knowledge of the user interface on single-user computers.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

↑ Back to the top


Summary

In some cases, you may want to export data to a quotation-mark and comma-delimited file, and you may want each value to be surrounded by quotation marks. By design, Microsoft Access will only place quotation marks around text values and not numeric values. This article describes a method that you can use to export data that has all values surrounded by quotation marks.

NOTE: The "More Information" section has two sections. Use the first section, "Creating and Exporting a Query Using Custom Specification," if you are working with a database file. Use the second section, "Creating and Exporting a View," if you are working with a Microsoft Access project.

↑ Back to the top


More information

To create a comma-delimited file that has quotation marks around each value, create a new query and export the results of this query. The following steps describe the process.

Creating and Exporting a Query Using Custom Specification

NOTE: This method applies only to a Microsoft Access database (.mdb).
  1. In the Database window, click Queries under Objects, and then click New. Click Design View, and then click OK.
  2. Add the table or query that you want to export.
  3. Instead of adding the field names to the query grid, use expressions. These expressions will concatenate quotation marks (ASCII character number 34) at the beginning and end of each value in a field. Type these expressions in the Field row of each column in the query grid. Use the following expressions as guidelines:
    FName: Chr(34) & [First Name] & Chr(34)

    -or-

    New Cost: Chr(34) & [Cost] & Chr(34)
    NOTE: The expression names (such as FName) must be different from the actual field names (such as First Name).
  4. Save the query as qryExport, and then close it.
  5. In the Database window, click Queries under Objects and select the qryExport query.
  6. On the File menu, click Export.
  7. In the Export Query 'qryExport' To dialog box, click Text Files in the Save as type list. In the File name box, type the name that you want to use. Click Save.
  8. In the Export Text Wizard dialog box, click the Delimited option. Click Next.
  9. In the next dialog box, make the following selections:
    Delimiter that separates your fields: Comma
    Text Qualifier: {none}
    If you want to export the field names, click to select the Include Field Names on First Row check box.
  10. Click Next. Verify the path and file name of your text file. Click Finish to complete the export.

Creating and Exporting a View

NOTE: This method applies only to a Microsoft Access project (.adp).

When you export a view, it automatically adds the characters "-" and "|" to build a table around the results.
  1. In the Database window, click Views under Objects, and then click New.
  2. On the View menu, click Show Table.
  3. Drag the table or view that you want to export onto the Diagram pane.
  4. Instead of just adding the field names to the grid, use expressions and an alias. These expressions will concatenate quotation marks (ASCII character number 34) at the beginning and end of each value in a field. Type these expressions in the Column field of the grid. Use the following expressions as guidelines:
    Column: Char(34) + [First Name] + Char(34)
    Alias: FName

    -or-

    Column: Char(34) + [Cost] + Char(34)
    Alias: New Cost
    NOTE: The alias names (such as FName) must be different from the actual field names (such as First Name).
  5. Save the view as ExportQuoteView, and then close it.
  6. With ExportQuoteView selected, on the File menu, click Export.
  7. In the Export View 'ExportQuoteView' To dialog box, click Text Files in the Save as type list. In the File name box, type the name that you want to use. Click Save.

↑ Back to the top


Keywords: KB208497, kbhowto

↑ Back to the top

Article Info
Article ID : 208497
Revision : 2
Created on : 7/13/2004
Published on : 7/13/2004
Exists online : False
Views : 284