Sergey -
Thanks for the tip. The article makes sense and helped me cleanup the code somewhat but I still cannot return focus to the textbox after the forms method runs. I have tried placing thisform.textbox1.setfocus in the form method and this still works when the method is called by the button but not when it is called by the textbox.
Any more thoughts?
btw - I'll be out after today, so have a great holiday!
>See
http://fox.wikis.com/wc.dll?Wiki~MethodsShouldNeverCallEvents>
>>Problem:
>>
>>A textbox contains code in its lostfocus event to click a button.
>>
>>if lastkey()=13
>>thisform.cmdSearch.click()
>>endif
>>
>>The click event of the button runs a procedure and returns focus to the textbox.
>>
>>thisform.findrec()
>>thisform.donstextbox1.SetFocus()
>>
>>This works properly when the button is clicked with the mouse but does not work when the click is called from the textbox. Instead of returning focus to the textbox, focus goes to the next control in the tab order.
>>
>>I tried calling the button.click from textbox.valid but this produces an error that says a setfocus cannot be called from a valid.
>>
>>Any suggestions?
>>
>>Thanks