Microsoft Knowledge Base Email Alertz

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

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 208497 - Last Review: July 13, 2004 - Revision: 1.1

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

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).

On This Page

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.

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.

APPLIES TO
  • Microsoft Access 2000 Standard Edition
Keywords: 
kbhowto KB208497
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate