ACC2000: Exporting to Text File Truncates to Two Decimals Places (208408)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q208408
Moderate: Requires basic macro, coding, and interoperability skills.

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.

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

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.

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.

Modification Type:MajorLast Reviewed:8/30/2002
Keywords:kb3rdparty kbprb KB208408