var tem:integer; s:string; tem:=strtoint(字段);//先把字段换成数据 tem:=tem+1; if tem<10 then s:='0000'+inttostr(tem) else if tem<100 then s:='000'+inttostr(tem) else if tem<1000 then s:='00'+inttostr(tem) else if tem<1000 then s:='0'+intostr(tem) if tem<10000 then s:=inttostr(tem); query.edit; query.fieldbyname('字段').asstring:=s; query.post;
事件里加上判断语句来实现
if eof then
edit1.text:= + '00001'
edit1.text:='0000'+inttostr(strtoint(query1.fieldbyname('KHBH').value)+1);
s:string;
tem:=strtoint(字段);//先把字段换成数据
tem:=tem+1;
if tem<10 then
s:='0000'+inttostr(tem)
else
if tem<100 then
s:='000'+inttostr(tem)
else
if tem<1000 then
s:='00'+inttostr(tem)
else
if tem<1000 then
s:='0'+intostr(tem)
if tem<10000 then
s:=inttostr(tem);
query.edit;
query.fieldbyname('字段').asstring:=s;
query.post;