Test if control has focus

Curry

Registered User.
Local time
Tomorrow, 04:52
Joined
Jul 21, 2003
Messages
73
Hi all,

This will be a quick one...I have searched and cannot find this.

I want to test if a particular control has the focus
eg

if gotfocus(mytextbox) then
dosomething
endif

the gotfocus(mytextbox) is not correct I know...can someone tell me what is correct top do this.

Thanks
 
Not sure what you're trying to do, but each control has a got focus event. Would that be the appropriate place for your code, making the test unnecessary? Failing that, have you looked at the ActiveControl Property in VBA Help?
 
Not sure what you're trying to do, but each control has a got focus event. Would that be the appropriate place for your code, making the test unnecessary? Failing that, have you looked at the ActiveControl Property in VBA Help?


I really just need to know if there is a way of testing if a control has currently got focus....I assumed I could do it like the test for null ie..
if isnull(Textbox) then
dosomething
endif

I have tried

if me.textbox.setfocus = true then
dosomething
endif

however this is also incorrect...

Is there anything similar to acheive what I want?
 

Users who are viewing this thread

Back
Top Bottom