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.

ACCESS: Exporting to Text File Truncates to Two Decimals Places


View products that this article applies to.

Symptoms

If you have a table that contains a Number field with more than two decimal places, and you export the table to a text file, the decimal places are truncated to two positions.

↑ Back to the top


Resolution

Method 1

When you export the data, you can select Save Formatted in the Export Table dialog box.

Method2

Create a query with the fields that you want to export and then use the Format() function. You can use the following function to specify the number of decimal places in the Number field. For example, if your field has four decimal places, the column in the query grid looks as follows:
Field: Format([fieldname],"##0.0000")
You can also use the CStr() function to convert the field to text before you export. For example, the column in the query grid looks as follows:
Field: CStr([fieldname])

↑ Back to the top


More information

Steps to Reproduce the Behavior

  1. Open the sample database Northwind.mdb.
  2. Open the Suppliers table in Design View.
  3. Add a field to the Suppliers table with the following properties:
       Field Name: Cost
       Data Type: Number
       Field Size: Double
       Decimal Places: 4
    					
  4. Close, and then save the table.
  5. Open the Suppliers table in Datasheet view, and then scroll right until you see the Cost field. Type data in this field for several records, and then make sure that the data contains at least three decimal places.
  6. Close the table, and then on the File menu, click Save.
  7. In the Save As Type box, click Text Files, and then click Export.
  8. When the Text Export Wizard appears, click Next two times, and then click Finish.

    When the file has been exported, open the text file. Note that the Cost field is truncated to two decimal places.

↑ Back to the top


References

For more information about exporting tables, click Microsoft Access Help on the Help menu, type export data or database objects to another database or file format in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Article Info
Article ID : 208408
Revision : 2
Created on : 1/1/0001
Published on : 1/1/0001
Exists online : False
Views : 637