Rabu, 08 Februari 2012

Penomoran Otomatis Delphi 07

var kd,st,newKd:string;
i,n:integer;
....
ADOTable1.Last;
if not(ADOTable1.eof and ADOTable1.Bof) then
begin
kd:=ADOTable1.FieldByName('kode').AsString;
// auto generate
for i:=1 to 2 do
st:=st+kd[i+1];
n:=strtoint(st)+1;
case length(inttostr(n)) of
1 : newKd:='K0'+inttostr(n);
2 : newKd:='K'+inttostr(n);
end;
end
else newKd:='K01';
Edit1.Text:=newKd;

Tidak ada komentar: