Ver Mensaje Individual
  #3  
Antiguo 14-09-2007
Avatar de enecumene
[enecumene] enecumene is offline
Miembro de Oro
 
Registrado: may 2006
Ubicación: Santo Domingo, Rep. Dom.
Posts: 3.040
Reputación: 22
enecumene Va por buen camino
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!!! . me funciona de pelos..

Saludos.
__________________

Mi BLOG - ¡Joder, leanse la guia de estilo!
Las Palabras son enanas, los ejemplos gigantes.
Responder Con Cita