You can use the VALID event in this manner and it will not return the default message:
if lastkey() = 27 or :
empty(this.value)
return 1
endif
if (validation code ok)
return 1
else
this.value = ""
messagebox("INVALID INPUT",48,"ATTENTION")
return 0
endif
The above code lets you bypass the validation altogether when the user presses a cancel button or some other control. If the validation does not succeed, you can show your own message, as above. If it succeeds, the next event that fires is LOSTFOCUS. In there you can use a form property to return the .F. value that you need.
Or save data or do whatever else has to be done after the validation took place.
I find the valid method very useful but you need to know how to use it properly.
Rafael Copquin
Treasurer - Microsoft Users Group of Argentina (MUG)
www.mug.org.ar