Hola Cabanyaler.
De este modo creo que estaría haciendo todo lo que buscas:
Código Delphi
[-]
...
procedure TForm1.DataSetStockSetText(Sender: TField; const Text: String);
var
Stock: Double;
begin
if not TryStrToFloat(Text, Stock) then
raise Exception.Create('Error no es un número válido')
else if Stock > DataSet.FieldByName('STOCK').AsFloat then
raise Exception.Create('Stock inexistente')
else
DataSet.FieldByName('STOCK').Value:= Stock;
end;
procedure TForm1.DBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if DBGrid1.EditorMode then
begin
if Key in [VK_ESCAPE,VK_TAB,VK_UP,VK_DOWN,VK_LEFT,VK_RIGHT] then
Key:= 0;
end;
end;
Saludos.