Microsoft KB Archive/115072

{| = How to Limit Input Fields Based on Memvars to Field Size =
 * width="100%"|

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.