var
Cnt, RecPnt: Integer; {*全局变量*}
...
Procedure NextClick(Sender: TObject);
Begin
Cnt := RecPnt;
With Table1 Do
Try
Open;
While Cnt<=RecordCount Do
Begin
If FieldValues['检索字段']=检索条件 Then
Begin
RecPnt := RecNo; Cnt = RecordCount;
End;
Inc(Cnt);
Next;
End;
Finally
Close;
End;
End;
DBGRID的datasource--datasource1的Dataset须为TABLE1,
然后在BUTTON的onclick事件中加上:
table1.locate('字段名',检索值,[]);
if table1.state<>dfedit then table1.edit;
locate可以确定的字段类型可以是浮点型,字符型,时间类型等等