Microsoft KB Archive/182762

= ACC97: Single with Currency Format Displays as Double When Edited =

Article ID: 182762

Article Last Modified on 1/22/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q182762



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



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 of data type Double. As a result, you may see unexpected values in the 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.



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

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

The following example demonstrates how to use a custom format with a data type Single on a form:

 Open any database in Microsoft Access 97.  Create the following table and save it as tblSingle:

      tblSingle --      Field Name: TestSingle Data Type: Number Field Size: Single   Open the table in Datasheet view and enter the following three records:

      TestSingle --       .15       1.23        .02

Close the tblSingle table.  In the Database Window, click the tblSingle table if it is not already selected. On the Insert menu, click AutoForm.</li> On the View menu, click Design View.</li> Select the TestSingle text box. On the View menu, click Properties.</li>  Click the Format tab and set the Format property to the following:

<pre class="fixed_text">      $#,##0.00;($#,##0.00);$0.00 </li> Save the form as frmSingle.</li> Open the frmSingle form in Form view, and edit the data in the TestSingle field. Note 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.</li></ol>

<div class="status_section">

STATUS
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

<div class="moreinformation_section">

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 - 7 in the "Workaround" section earlier in this article.
 * 2) Click the Format tab, and then click the Format property box. Select Currency from the drop-down list.
 * 3) Save the form as frmSingle and switch to Form view.
 * 4) Try to edit the data in the TestSingle field. Note that the value is displayed as a Double rather than as a Single. As a result, you see unexpected digits to the right of the decimal point.

<div class="references_section">