Hi Charlie,
the problem is that you can not setfocus from valid (or from a method called from valid).
A timer may be of help.
Add a timer to your form, enabled=.f.; interval to something short (but not to short); in the timer event call the second form like
this.enabled=.f.
secondform.show()
In the valid of your textbox add
...
otimer.reset()
otimer.enabled=.t.
Agnes
>My application has two forms visible: one, in the foreground, is a data entry form, the other, in the background, displays a grid of possible duplicate records. The desired behavior is that the user will enter a customer's first & last name in the first form. The last name textbox's .Valid() code then calls a method in the second form that searches for and displays any existing customers with matching names. So far so good. At this point, I want to bring the second form to the top, which is where I'm having the problem.
>
>I know I can't SetFocus() to the second form's grid (or to anyplace else)from the first form's textbox Valid() event. The documentation suggests using .LostFocus() as a place to do that. But when I try, the second form's grid momentarily gets the focus, then focus jumps right back to the first form (in the data entry textbox following the last name textbox). The same occurs when I call the second form's .Show() event. Any ideas on how to keep focus on the second form once it gets there?
>
>Thanks in advance!
>
>Charlie Hancock
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]