Partager via


How to: Specify Captions for Fields

For database tables, you can specify and display a caption instead of the field name in the column header of a browse window or grid. The caption can be text or an expression.

Note

Expressions cannot exceed 254 characters. If the expression exceeds 254 characters, the caption defaults to the field name.

To specify a caption for a field

  1. Open the database containing the table.

  2. Open the table in the Table Designer.

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

  4. In the Caption box of the Display area, type the text for the field caption.

    Tip

    To specify an expression for a field caption, include an equal sign (=) preceding the caption string.

For more information, see Fields Tab, Table Designer.

To specify a caption for a field programmatically

  • Use the DBSETPROP( ) function with the Caption field property.

For more information, see DBSETPROP( ) Function.

For example, the following code specifies the caption "Supplier_Fax" for a field named Fax in a supplier table:

DBSETPROP('Supplier.Fax', 'Field', 'Caption', 'Supplier_Fax')

See Also

Tasks

How to: Open Databases

How to: Edit Table Structure

Other Resources

Working with Fields

Working with Tables (Visual FoxPro)