ACC2000: Fields with Single Data Type and Currency Format Are Displayed As Double Data Type When Edited (207832)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q207832

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

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

SYMPTOMS

While you are editing data in a field whose data type is Single and whose Format property is set to Currency, the data is displayed as a number with the Double data type. As a result, you may see unexpected digits to the right of the decimal point. When you have finished editing and you move the focus away from the field, the data appears in Currency format as expected. This behavior can occur while you are editing data in a Table, a Form, or a Query.

RESOLUTION

Use the following format instead of the built-in Currency format to ensure that numbers of data type Single are not displayed inappropriately during editing:

$#,##0.00;($#,##0.00);$0.00

To apply this workaround on a form, follow these steps:
  1. Open any database.
  2. Create a new table with the following field:

    Field Name: TestSingle
    Data Type: Number
    Field Size: Single

  3. Save the table as tblSingle, open the table in Datasheet view, and then type the following three records:

    TestSingle
    0.15
    1.23
    0.02

  4. Close the tblSingle table.
  5. In the Database window, click tblSingle if it is not already selected.
  6. On the Insert menu, click AutoForm.
  7. On the View menu, click Design View.
  8. Click the TestSingle text box, and then on the View menu, click Properties.
  9. Click the Format tab and set the Format property to the following:

    $#,##0.00;($#,##0.00);$0.00

  10. Save the form as frmSingle.
  11. Open the frmSingle form in Form view, and then click the TestSingle field.

    Notice that during the editing process, the data in the TestSingle field appears as a number of data type Single instead of a number of data type Double.

MORE INFORMATION

The decimal precision of the data type Single is 7; the decimal precision of the data type Double is 15.

Steps to Reproduce Behavior

  1. Follow steps 1 through 8 in the "Resolution" section.
  2. Click the Format tab, and then select Currency in the Format list.
  3. Save the form as frmSingle, and then switch to Form view.
  4. Click the TestSingle field.

    Note that the value is displayed as a Double rather than as a Single data type. As a result, you see unexpected digits to the right of the decimal point.

REFERENCES

For more information about the Format property, click Microsoft Access Help on the Help menu, type format property in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

For more information about the Fieldsize property, click Microsoft Access Help on the Help menu, type fieldsize property in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MajorLast Reviewed:6/29/2004
Keywords:kbpending kbprb KB207832