PRB: Pressing ENTER Key in Numeric GET Field Zeros the Field

Last reviewed: June 27, 1995
Article ID: Q88232
This information in the article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
  • Microsoft FoxPro for Windows, version 2.5a

SYMPTOMS

Pressing the ENTER key in a numeric GET field overwrites the current value of the field with zeros.

CAUSE

The GET field has a PICTURE clause that begins with a decimal point character.

RESOLUTION

Specify a PICTURE clause that is wide enough to include all the digits in the field, including an implied digit before the decimal point.

MORE INFORMATION

The width of any numeric field that contains a decimal point must be at least 3: one place for each digit to the left and right of the decimal point, and one for the decimal point itself.

In a PICTURE clause that begins with a decimal point (for example, PICTURE

'.999'), the implied digit to the left of the decimal point is truncated
because it does not fit in the picture.

Even if the digit to the left of the decimal point is zero (for example, 0.12), pressing the ENTER key without specifying a value places 0.000 into the variable.

To correct this situation in the examples, change the PICTURE clause to read as follows: PICTURE '9.999'.


Additional reference words: FoxWin FoxDos 2.00 truncate cut off 2.50 2.50a
KBCategory: kbprg kbprb
KBSubcategory: FxprgGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.