procedure TForm1.Button11Click(Sender: TObject);
var
count,i,pos:integer;
str:string;
begin
table1.Active:=true;
table3.Active:=true;
str:=table1.FieldValues['学号'];
table1.Delete;
while table3.Locate('学号',str,[loCaseInsensitive]) do//判断从表里是否有和主表'学号'一栏简直相同的内容
begin
pos:=table3.FieldByName('序号').AsInteger;
count:=table3.RecordCount-1;
table3.Delete;
for i:=pos to count do
begin
table3.Edit;
table3.FieldByName('序号').AsString:=IntToStr(i);
table3.Next;
end;//调整从表的序号
table3.Refresh;
table1.Refresh;
end;
Button11.Enabled:=false;
Button13.Enabled:=false;
Button9.Enabled:=true;
end;
上为两表 1 3 ,3为从表,两表以‘学号’为联系,楼主可以参考参考