Partager via


How to: Specify Input Masks for Fields

You can make it possible to enter and store values in fields for database tables in a uniform manner, reducing data entry errors and making processing more efficient. You can accomplish this by defining the punctuation, spacing, and other format attributes for values entered in a field using an input mask.

For example, you can make it possible to enter and store telephone numbers in a field by adding an input mask appropriate for telephone numbers to a numeric field, for example (999) 999-9999. The input mask helps the user enter telephone numbers more quickly because the formatting is provided. For more information about input mask characters, see InputMask Property.

To specify an input mask for a field

  1. Open the database containing the table.

  2. Open the table in the Table Designer (Visual FoxPro).

  3. On the Fields tab, select the field that you want.

  4. In the Input mask box of the Display area, type the input mask characters that you want.

For more information, see Fields Tab, Table Designer.

To specify an input mask for a field programmatically

  • Use the DBSETPROP( ) function to set the InputMask field property.

For more information, see DBSETPROP( ) Function.

For example, the following code specifies an input mask for a date:

DBSETPROP("Orders.Postalcode","Field","InputMask", "99999-9999")

See Also

Tasks

How to: Open Databases
How to: Edit Table Structure

Other Resources

Working with Fields
Working with Tables (Visual FoxPro)