在DBGRID控件的ONKEYPRESS事件中编写如下代码:
if (key=char(vk_return)) and
(dbgrid1.selectedindex<table1.fieldcount-1 ) then
dbgrid1.selectedindex:=dbgrid1.selectedindex+1
else
if dbgrid1.selectedindex=table1.fieldcount-1 then
begin
table1.append;
dbgrid1.selectedindex:=0;
end;