Ver Mensaje Individual
  #1  
Antiguo 12-12-2017
Avatar de The Cid James
The Cid James The Cid James is offline
Miembro
NULL
 
Registrado: jun 2013
Posts: 129
Reputación: 11
The Cid James Va por buen camino
Asignar valor de Locate

Buenas gente necesito asignar el valor del locate del siguiente codigo a una variable de tipo integer, el problema es que siempre me devuelve 0 el resultado
Código Delphi [-]
procedure Tfstock.Button1Click(Sender: TObject);
begin
  if fmodulo.tProductos.Locate('id_producto', fmodulo.qProductos['id_producto'], [])
    then
      fstockproductos := Tfstockproductos.Create(self);
      fstockproductos.ShowModal;
      fstockproductos.Bsprestar.Visible := false;
      idproducto := fmodulo.qProductos.Fields.FieldByName('id_producto').AsInteger;
end;

Este valor seria el parametro para editar las cantidades de esta forma

Código Delphi [-]
procedure Tfstockproductos.BspaumentarClick(Sender: TObject);
begin
fmodulo.qProductos.Active := true;
fmodulo.tProductos.Active := true;
if fmodulo.tProductos.Locate('id_producto', fstock.idproducto, [])
  then
    begin
      fmodulo.tProductos.Edit;
      fmodulo.tProductos.Fields.FieldByName('Stock').AsInteger := fmodulo.qProductos.Fields.FieldByName('Stock').AsInteger + StrToInt(Estockproductos.text);
      fmodulo.tProductos.Post;
      fmodulo.qProductos.Refresh;
      close;
      fmodulo.tProductos.Active := false;
      fstock.idproducto := 0;
end
else
 ShowMessage('no encontrado '+ '- ' +IntToStr(fstock.idproducto));
end;
__________________
We are told to remember the idea, not the man, because a man can fail. He can be caught, he can be killed and forgotten, but 400 years later, an idea can still change the world.
Responder Con Cita