SearchPrevRecord finds the previous RMS record of the open RMS file by using primary, secondary index or searching sequentially.  It detects which index to use.


Function SearchPrevRecord(rmsHandle as Integer, bestindex As Integer) As Integer



RMS file handle


The flag controls whether to use the best secondary index to search record. The flag

can be set to 1 or 0.  If it is set to 1, the function tries to select the best secondary index

to find the record.

Return Values

On success, SearchPrevRecord returns 1.  If there is no matching record, it returns 0.


Before calling function SearchNextRecord,  you must set the query fields data by calling

functions RegisterStringFieldDataRegisterStringFieldData, RegisterCharFieldDataRegisterCharFieldData, RegisterIntegerFieldDataRegisterIntegerFieldData,

RegisterLongFieldDataRegisterLongFieldData, RegisterRealFieldDataRegisterRealFieldData, RegisterMoneyFieldDataRegisterMoneyFieldData,

RegisterDateFieldDataRegisterDateFieldData, RegisterTimeFieldDataRegisterTimeFieldData or RegisterBoolFieldDataRegisterBoolFieldData depends

on field types. 

If you want to let function SearchNextRecord store the specified fields data in the

internal query buffer, you can call RegisterFieldRegisterField to add field names to the internal data query

field name list before calling function SearchNextRecord. By default,

SearchNextRecordstore all fields’ data in the query buffer. 

To get fields data:

If function RegisterFieldRegisterField is not called, first call GetFieldCountGetFieldCount to get the number of fields in

the RMS file then for each field call GetFieldTypeGetFieldType and GetStringFieldGetStringField, GetCharFieldGetCharField,

GetIntegerFieldGetIntegerField, GetLongFieldGetLongField, GetRealFieldGetRealField, GetMoneyFieldGetMoneyField, GetDateFieldGetDateField,

GetTimeFieldGetTimeField, GetBooleanFieldGetBooleanField depends on the field types

If function RegisterFieldRegisterField is called, call FirstRegistedFieldFirstRegistedField and NextRegistedFieldNextRegistedField to get

the field names corresponding to the field data in the query buffer and for each field name call

GetFieldTypebyNameGetFieldTypebyName and  GetStringFieldbyNameGetStringFieldbyName, GetCharFieldbyNameGetCharFieldbyName,

GetIntegerFieldbyNameGetIntegerFieldbyName, GetLongFieldbyNameGetLongFieldbyName, GetRealFieldbyNameGetRealFieldbyName,

GetMoneyFieldbyNameGetMoneyFieldbyName, GetDateFieldbyNameGetDateFieldbyName, GetTimeFieldbyNameGetTimeFieldbyName and

GetBooleanFieldbyNameGetBooleanFieldbyName depends on the field types.

See Also

SearchFirstRecord, SearchNextRecord, SearchPrevRecord,

SetSearchIndex, SearchLastRecord.