>Thank´s George !!
>
>I know valid occurs before the lostfocus, the problem is the lostfocus those not occurs when you click on a control outside of the grid.
Sorry, Joao, I didn't get the part about clicking on a control outside of the grid. As Cetin mentioned this is a known problem. There are a couple of ways to handle this. I prefer, what I believe to be the simplest, and most direct. Given the code you've shown, why bother to reset the value in .LostFocus if Valid is being executed. Simply
IF This.Value > 1000
= MESSAGEBOX('Maximum value is 1000', 64, ThisForm.Caption)
This.Value = 0
RETURN .F.
ENDIF
This will mean less code (and maintenance) for you.
George
Ubi caritas et amor, deus ibi est