ACC2000: Exporting to Text file Truncates to Two Decimals Places

ID: Q208408


The information in this article applies to:

Moderate: Requires basic macro, coding, and interoperability skills.


SYMPTOMS

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


RESOLUTION

To work around this behavior, instead of exporting the table, create a query with the fields that you want to export and use the Format() function to specify the number of decimal places in the Number field. For example, if your field has 4 decimal places, the column in the query grid would look as follows:

Field: Format([fieldname],"##0.0000")


MORE INFORMATION

Steps to Reproduce 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:


  4. 
       Field Name: Cost
       Data Type: Number
       Field Size: Double
       Decimal Places: 4 
  5. Close and save the table.


  6. Open the Suppliers table in Datasheet view and scroll right until you see the Cost field. Type data into this field for several records, and make sure the data contains at least 3 decimal places.


  7. Close the table, and on the File menu, click Save.


  8. In the Save As Type box, click Text Files, and then click Export.


  9. When the Text Export Wizard appears, click Next twice, 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.

Additional query words: round rounding prb truncate


Keywords          : kb3rdparty kbdta IsmTxtd 
Version           : WINDOWS:2000
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: June 16, 1999