RecordRefresh Method
Refreshes the current field values for the specified records.
CursorAdapter.RecordRefresh([nRecords],[ nRecordOffset])
Parameters
- nRecords
Specifies the number of consecutive records (in physical order) to refresh. nRecords is an integer greater than or equal to zero. If nRecords is 1 or you omit nRecords, only the field values in the current record are refreshed. If nRecords is 0, no field values are refreshed.
nRecordOffset
Specifies the number of records before the current record where the refresh begins. nRecordOffset is an integer greater than, less than, or equal to zero.For example, if the current record is record 10 and nRecordOffset is 4, record refresh begins with record 6. If nRecordOffset is 0 or you omit nRecordOffset, the refresh begins with the current record.
Return Value
Numeric. The RecordRefresh method returns the number of refreshed records or zero if no records were refreshed and there were no errors. For example, zero is returned if all target records are buffered inserts or nRecords is zero. In case of failure, a negative integer is returned which represents the negative value of the number of successfully refreshed records minus 1.
Remarks
Applies To: CursorAdapter Class
The RecordRefresh method refreshes the current field values for the target records. Use the CURVAL( ) Function to determine current field values.
The tables or cursors must be opened exclusively.
The refresh operation is not supported buffered inserts, which are simply ignored, and no error is generated. If a target record has buffered table or record changes, those changes are preserved, and the current field values are refreshed.
If a target record cannot be located in at least one base table, the target record’s current field values are not refreshed and the record is marked as DELETED. Records are refreshed record by record until the number of records specified by nRecords is refreshed or until a failure occurs. When the refresh key is not unique an error is generated.
The CursorAdapter FetchMemo Property setting is respected during the refresh operation unless there is an index on a Memo field. In this case, the Memo field is fetched regardless of the FetchMemo property setting. Long running RecordRefresh execution can be interrupted by pressing ESC; no error is generated.
Use the AERROR( ) function to determine the cause of failure of the RecordRefresh method. The ON ERROR Command and TRY...CATCH...FINALLY Command cannot be used to determine the cause of RecordRefresh method errors.
The RecordRefresh method is integrated with the REFRESH( ) Function. If the REFRESH( ) function is called for a cursor associated with a CursorAdapter object, the RecordRefresh method is called for the CursorAdapter object. For backward compatibility, the REFRESH( ) function returns zero if the RecordRefresh method fails.
Note
The RecordRefresh method uses CursorAdapter properties. In Visual FoxPro 8, the REFRESH( ) function always uses cursor properties set with the CURSORSETPROP( ) Function and the CURSORGETPROP( ) Function regardless of whether or not the cursor is associated with a CursorAdapter object.