>>>Have you tried testing thisform.ActiveControl.name ?
>
>Why would you compare the name? Compare the reference to avoid the problems you mention no? I've used this approach in many apps and it works well enough...
Checking thisform.ActiveControl for null and then checking thisform.ActiveControl=this should suffice, like I said below.
>>Not enough. It could be a control in one of many containers of the same class, and a member in each of these containers would have the same .name. We'd have form.container1.textbox1, form.container2.textbox1 again etc. Instead, compobj(thisform.activecontrol, this) would do it.
>>
>>Though it's possible that nothing has control at the time, i.e. thisform.activecontrol may be null, so some checking needs to be done.