Hi Calvin,
You cannot call SetFocus() from Valid()/When().
Move source code from Valid() to LostFocus().
MartinJ
>This one is driving me nuts, because I know there is a solution but I cannot remember it. I have the following code in the Valid for a drop down list box. It works very well unless the user clicks in the edit box behind the list box. When that happens the .setfocus command causes an error 2012. How can you tell if the user exits a list box by using a mouse click elsewhere? Is there any way to prevent this error. Thanks!
>
>this.Visible=.f.
>thisform.LockScreen=.t.
>WITH this.Parent.eb1
> holdstart=.selstart
> newlen=holdstart+LEN(TRIM(letterstuff.descript))+5
> .value=SUBSTR(.value,1,.selstart)+'<<'+TRIM(letterstuff.descript)+'>> '+SUBSTR (.value,.selstart+1)
> .refresh()
> thisform.LockScreen=.f.
> .selstart=newlen
> .setfocus()
>ENDWITH