Gracias poliburro por tu buen ojo me di cuenta que me faltaba un clear:
Código Delphi
[-]procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then begin
if Edit1.Text = '' then begin
ShowMessage('Item no existe');
end else begin
ZQuery1.Close;
ZQuery1.SQL.Clear;<----AQUI
ZQuery1.SQL.Add('Select item, codigo from items');
ZQuery1.SQL.Add(' where codigo = :cod');
ZQuery1.ParamByName('cod').Value:=Edit1.Text;
ZQuery1.Open;
if not ZQuery1.IsEmpty then begin
StringGrid1.Row := StringGrid1.Rowcount - 1;
StringGrid1.Cells[0,StringGrid1.Row] := ZQuery1.Fields[0].Value;
StringGrid1.Cells[1,StringGrid1.Row] := ZQuery1.Fields[1].Value;
StringGrid1.RowCount := StringGrid1.RowCount + 1;
Edit1.Clear;
Edit1.SetFocus;
end else
ShowMessage('Item no existe');
end;
end;
end;
Muchas Gracias!!!
![Smilie](http://www.clubdelphi.com/foros/images/smilies/smile.gif)
. me funciona de pelos..
Saludos.