Saves changes to the current record in the currently active table.

Syntax

<oRef>.saveRecord( )

<oRef>

An object reference to the form.

Property of

Form, SubForm

Description

Use saveRecord( ) for form-based data handling with tables in work areas. When using the data objects, saveRecord( ) has no effect; use the rowset’s save( ) method instead.

Form-based data buffering lets you manage the editing of existing records and the appending of new records. Editing changes to the current record are not written to the table until there is navigation off the record, or until saveRecord( ) is called. Each work area has its own separate edit buffer. For example, if you have two controls dataLinked to two different work areas, and you change both controls, you must call saveRecord( ) while each work area is selected to commit the changes.

To append a new record, call beginAppend( ). This empties the record buffer for the currently selected work area. Calling saveRecord( ) writes the new record to the table, leaving you at the newly added record. Calling beginAppend( ) instead of saveRecord( ) will write the new record and empty the buffer again so you can add another record.

When appending records with beginAppend( ) the new record will not be saved when you call saveRecord( ) unless there have been changes to the record; the blank new record is abandoned. This prevents the saving of blank records in the table. (If you want to create blank records, use APPEND BLANK). You can check there have been changes by calling isRecordChanged( ). If isRecordChanged( ) returns true, you should validate the record with form-level or row-level validation before writing it to the table.

To abandon the changed or new record instead of saving it, call abandonRecord( ).