Partager via


How to: Add Data to Records

You can add data to records after creating blank records or replace data in existing records. You can also edit each field in a record on a separate line by working with the table in edit mode. For more information, see How to: Add Records to Tables.

To add or replace data in records

  1. Open the table in a browse window.

    Tip

    To view each field on a separate line, on the View menu, click Edit.

  2. In the table, insert the cursor in the field of the record you want, and type the data appropriate for the field's data type.

For more information, see How to: View Records in Tables.

To store data in records programmatically

  • Choose one of the following:

    • If the blank record you added is the current record, follow the APPEND BLANK command with the REPLACE command and specify the record to replace values in.

      Tip

      By default, REPLACE replaces values in fields, including empty fields for the current record. When you use REPLACE, make sure the table is open, that the record exists, that you specify the field you want to store values in, and a value for each field that is appropriate for the field's data type.

    -OR-

    • Open the table, then use the EDIT or CHANGE commands to display the table in edit mode.

    -OR-

    • Use the SQL UPDATE command to update records in a table.

For more information, see REPLACE Command (Visual FoxPro), EDIT Command, CHANGE Command, and UPDATE - SQL Command.

Tip

When you use the REPLACE or the SQL UPDATE command in a multiple user application, you can edit data without locking the record until you want to commit changes by turning on record or table buffering. For more information, see Programming for Shared Access.

Adding Null Values to Records

You can type null values for fields in records.

Note

To specify the text displayed for null values, use the SET NULLDISPLAY command. For more information, see SET NULLDISPLAY Command.

To store a null value in a field

  1. Open the table in a browse window.

  2. In the table, insert the cursor in the field of the record you want, and press CTRL+0 (zero).

To store a null value in a field programmatically

  • Include the NULL keyword with the command you use to add or replace data.

See Also

Tasks

How to: Delete Records in Tables

Other Resources

Working with Records

Working with Tables (Visual FoxPro)