How to Limit Input Fields Based on Memvars to Field Size

Last reviewed: June 27, 1995
Article ID: Q115072
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6
  • Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, 2.5b, 2.6
  • Microsoft FoxPro for Macintosh, versions 2.5b, 2.5c

Input fields based on memory variables on a screen do not necessarily limit the number of characters that are entered to the size of the underlying table field.

In contrast, when a screen field is based directly on the table field, you cannot enter more characters than the size of the field. By default, the width of the field on a screen that is created by the Screen Generator closely approximates the actual table field size, but if the font or the width of the field is changed, the changed field may allow more characters to be entered than can be committed to the table field.

To limit the number of characters entered to match the table field size, use the PICTURE clause in the Format dialog box of the field. For example:

  • To limit input to 5 numbers, type "99999" (without the quotation marks) in the Format dialog box of the screen field.
  • To limit input to 3 alphabetic characters, type "AAA" (without the quotation marks) in the Format dialog box of the screen field.
  • To limit input to 6 of any kind of character, type "XXXXXX" (without the quotation marks) in the Format dialog box of the screen field.

REFERENCES

For additional PICTURE code options, see pages L3-34 and L3-35 of the "Language Reference" for FoxPro for MS-DOS and Windows or see page 47 of the "Language Reference" for FoxPro for Macintosh.


Additional reference words: FoxMac FoxDos FoxWin 2.50 2.50a 2.50b 2.50c
2.60
memvars
restrict
exceed greater
KBCategory: kbenv kbprg
KBSubcategory: FxenvMemory


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.